# go-filecoin **Repository Path**: zorro188/go-filecoin ## Basic Information - **Project Name**: go-filecoin - **Description**: Filecoin Full Node Implementation in Go - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-09-20 - **Last Updated**: 2024-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Filecoin (go-filecoin) [![CircleCI](https://circleci.com/gh/filecoin-project/go-filecoin.svg?style=svg)](https://circleci.com/gh/filecoin-project/go-filecoin) [![User Devnet Release](https://img.shields.io/endpoint.svg?color=brightgreen&style=flat&logo=GitHub&url=https://raw.githubusercontent.com/filecoin-project/go-filecoin-badges/master/user-devnet.json)](https://github.com/filecoin-project/go-filecoin/releases/latest) [![Nightly Devnet Release](https://img.shields.io/endpoint.svg?color=blue&style=flat&logo=GitHub&url=https://raw.githubusercontent.com/filecoin-project/go-filecoin-badges/master/nightly-devnet.json)](https://github.com/filecoin-project/go-filecoin/releases) [![Staging Devnet Release](https://img.shields.io/endpoint.svg?color=brightgreen&style=flat&logo=GitHub&url=https://raw.githubusercontent.com/filecoin-project/go-filecoin-badges/master/staging-devnet.json)](https://github.com/filecoin-project/go-filecoin/releases) > Filecoin implementation in Go, turning the world’s unused storage into an algorithmic market. __Questions or problems with go-filecoin? [Ask the community first](#community)__. Your problem may already be solved. __Want to connect to a devnet (developer network)? See the [Usage](#usage) section below.__ ## Table of Contents - [What is Filecoin?](#what-is-filecoin) - [Install](#install) - [System Requirements](#system-requirements) - [Install from Source](#install-from-source) - [Install Go and Rust](#install-go-and-rust) - [Install Dependencies](#install-dependencies) - [Build, Run Tests, and Install](#build-run-tests-and-install) - [Manage Submodules Manually (optional)](#manage-submodules-manually-optional) - [Usage](#usage) - [Advanced usage](#advanced-usage) - [Setting up a localnet](#setting-up-a-localnet) - [Contributing](#contributing) - [Community](#community) - [Developer Networks](#developer-networks) - [License](#license) ## What is Filecoin? Filecoin is a decentralized storage network that turns the world’s unused storage into an algorithmic market, creating a permanent, decentralized future for the web. **Miners** earn the native protocol token (also called “filecoin”) by providing data storage and/or retrieval. **Clients** pay miners to store or distribute data and to retrieve it. Check out [How Filecoin Works](https://github.com/filecoin-project/go-filecoin/wiki/How-Filecoin-Works) for more. **WARNING**: `go-filecoin` is a work in progress and is not ready for production use. See [KNOWN_ISSUES](https://github.com/filecoin-project/go-filecoin/blob/master/KNOWN_ISSUES.md) for an outline of known vulnerabilities. ## Install 👋 Welcome to Go Filecoin! ### System Requirements Filecoin can build and run on most Linux and MacOS systems with at least 8GB of RAM. Windows is not yet supported. ### Install from Source Clone the git repository: ```sh mkdir -p ${GOPATH}/src/github.com/filecoin-project git clone https://github.com/filecoin-project/go-filecoin.git ${GOPATH}/src/github.com/filecoin-project/go-filecoin ``` Now install the tools and dependencies listed below. If you have **any problems building go-filecoin**, see the [Troubleshooting & FAQ](https://github.com/filecoin-project/go-filecoin/wiki/Troubleshooting-&-FAQ) Wiki page. #### Install Go and Rust The build process for go-filecoin requires: - [Go](https://golang.org/doc/install) >= v1.12.1 - Installing Go for the first time? We recommend [this tutorial](https://www.ardanlabs.com/blog/2016/05/installing-go-and-your-workspace.html) which includes environment setup. - [Rust](https://www.rust-lang.org/) >= v1.36.0 and `cargo` - `pkg-config` - used by go-filecoin to handle generating linker flags - Mac OS devs can install through brew `brew install pkg-config` Due to our use of `cgo`, you'll need a C compiler to build go-filecoin whether you're using a prebuilt libsector_builder_ffi (our cgo-compatible rust-fil-proofs library) or building it yourself from source. If you want to use `gcc` (e.g. `export CC=gcc`) when building go-filecoin, you will need to use v7.4.0 or higher. - You must have libclang on you linker search path in order to build rust-fil-proofs from source. You can satisfy this requirement in most environments by installing Clang using your favorite package manager. #### Install Dependencies `go-filecoin` depends on some proofs code written in Rust, housed in the [rust-fil-proofs](https://github.com/filecoin-project/rust-fil-proofs) repo and consumed as a submodule. You will need to have `cargo` and `jq` installed. First we need to load all the submodules. ```sh git submodule update --init --recursive ``` To install golangci-lint and other build and test dependencies (with precompiled proofs, recommended), run: ```sh cd ${GOPATH}/src/github.com/filecoin-project/go-filecoin FILECOIN_USE_PRECOMPILED_RUST_PROOFS=true go run ./build deps ``` Note: The first time you run `deps` can be **slow** as a ~1.6GB parameter file is either downloaded or generated locally in `/var/tmp/filecoin-proof-parameters`. Have patience; future runs will be faster. #### Build, Run Tests, and Install ```sh # First, build the binary go run ./build build # Then, run the unit tests. go run ./build test # Build and test can be combined! go run ./build best ``` Other handy build commands include: ```sh # Check the code for style and correctness issues go run ./build lint # Run different categories of tests by toggling their flags go run ./build test -unit=false -integration=true -functional=true # Test with a coverage report go run ./build test -cover # Test with Go's race-condition instrumentation and warnings (see https://blog.golang.org/race-detector) go run ./build test -race # Deps, Lint, Build, Test (any args will be passed to `test`) go run ./build all ``` Note: Any flag passed to `go run ./build test` (e.g. `-cover`) will be passed on to `go test`. If you have **problems with the build**, please see the [Troubleshooting & FAQ](https://github.com/filecoin-project/go-filecoin/wiki/Troubleshooting-&-FAQ) Wiki page. #### Manage Submodules Manually (optional) If you're editing `rust-fil-proofs`, you need to manage the submodule manually. If you're *not* editing `rust-fil-proofs` you can relax: `deps` build (above) will do it for you. You may need to run `deps` again after pulling master if the submodule is updated by someone else (it will appear modified in `git status`). To initialize the submodule: ```sh cd ${GOPATH}/src/github.com/filecoin-project/go-filecoin git submodule update --init ``` Later, when the head of the `rust-fil-proofs` `master` branch changes, you may want to update `go-filecoin` to use these changes: ```sh git submodule update --remote ``` Note that updating the `rust-fil-proofs` submodule in this way will require a commit to `go-filecoin` (changing the submodule hash). ## Usage The [Getting Started](https://github.com/filecoin-project/go-filecoin/wiki/Getting-Started) wiki page contains a simple sequence to get your Filecoin node up and running and connected to a devnet. The [Commands](https://github.com/filecoin-project/go-filecoin/wiki/Commands) page contains further detail about specific commands and environment variables, as well as scripts for for setting up a miner and making a deal. To see a full list of commands, run `go-filecoin --help`. ### Advanced usage #### Setting up a localnet The localnet FAST binary tool allows users to quickly and easily setup a local network on the users computer. Please refer to the [localnet README](https://github.com/filecoin-project/go-filecoin/tree/master/tools/fast/bin/localnet#localnet) for more information. The localnet tool is only compatible when built from the same git ref as the targeted `go-filecoin` binary. ## Contributing We ❤️ all our contributors; this project wouldn’t be what it is without you! If you want to help out, please see [CONTRIBUTING.md](CONTRIBUTING.md). Check out the [Go-Filecoin code overview](CODEWALK.md) for a brief tour of the code. ## Community Here are a few places to get help and connect with the Filecoin community: - [Documentation Wiki](https://github.com/filecoin-project/go-filecoin/wiki) — for tutorials, troubleshooting, and FAQs - The `#fil-dev` channel on [Filecoin Project Slack](https://filecoinproject.slack.com/messages/CEHHJNJS3/) or [Matrix/Riot](https://riot.im/app/#/room/#fil-dev:matrix.org) - for live help and some dev discussions - [Filecoin Community Forum](https://discuss.filecoin.io) - for talking about design decisions, use cases, implementation advice, and longer-running conversations - [GitHub issues](https://github.com/filecoin-project/go-filecoin/issues) - for now, use only to report bugs, and view or contribute to ongoing development. PRs welcome! Please see [our contributing guidelines](CONTRIBUTING.md). - [Filecoin Project Specification](https://github.com/filecoin-project/specs) - how Filecoin is supposed to work Looking for even more? See the full rundown at [filecoin-project/community](https://github.com/filecoin-project/community). ## Developer Networks There are currently 3 developer networks (aka devnets) available for development and testing. These are subject to _**frequent downtimes and breaking changes**_. See [Devnets](https://github.com/filecoin-project/go-filecoin/wiki/Devnets) in the wiki for a description of these developer networks and instructions for connecting your nodes to them. ## License The Filecoin Project is dual-licensed under Apache 2.0 and MIT terms: - Apache License, Version 2.0, ([LICENSE-APACHE](https://github.com/filecoin-project/go-filecoin/blob/master/LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0) - MIT license ([LICENSE-MIT](https://github.com/filecoin-project/go-filecoin/blob/master/LICENSE-MIT) or http://opensource.org/licenses/MIT) [1]: https://golang.org/dl/ [3]: https://github.com/RichardLitt/standard-readme [4]: https://golang.org/doc/install [5]: https://www.rust-lang.org/en-US/install.html