kauri

7 min read - Posted 13 May 19

Filecoin: Peer-to-Peer Storage Network and Payment Protocol

Filecoin is a decentralized storage network that turns cloud storage into an algorithmic market. The market runs on a blockchain with a native protocol token (also called “Filecoin”), which miners earn by providing storage to clients.

Filecoin (go-filecoin)

Filecoin implementation in Go, turning the world’s unused storage into an algorithmic market.

Questions or problems with go-filecoin? Ask the community first. Your problem may already be solved.

Want to connect to a devnet (developer network)? See the Usage section below.

Table of Contents

<!-- TOC generated by https://github.com/thlorenz/doctoc Install with npm install -g doctoc. Regenerate with doctoc README.md. It's ok to edit manually if you don't have/want doctoc. -->

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 for more.

WARNING: go-filecoin is a work in progress and is not ready for production use. See KNOWN_ISSUES for an outline of known vulnerabilities.

Install

👋 Welcome to Go Filecoin!

<!-- - To run go-filecoin for mining, storing or other exploring, jump straight to detailed setup instructions. - To build go-filecoin from source for development, keep following this README. -->

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 Release Binary

Install from Source

Clone the git repository:

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 Wiki page.

Install Go and Rust

The build process for go-filecoin requires:

  • Go >= v1.12.1
    • Installing Go for the first time? We recommend this tutorial which includes environment setup.
  • Rust >= v1.31.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 libfilecoin_proofs (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 repo and consumed as a submodule. You will need to have cargo and jq installed.

To install golangci-lint and other build and test dependencies (with precompiled proofs, recommended), run:

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 /tmp/filecoin-proof-parameters. Have patience; future runs will be faster.

Build, Run Tests, and Install
# First, build the binary
go run ./build build

# Install go-filecoin to ${GOPATH}/bin (necessary for tests)
go run ./build install

# Then, run the unit tests.
go run ./build test

# Build and test can be combined!
go run ./build best

Other handy build commands include:

# 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 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:

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:

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 wiki page contains a simple sequence to get your Filecoin node up and running and connected to a devnet.

The 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
Connecting to a devnet with different code

In order to prevent user error, code has been added to filecoin that makes it hard to accidentally connect to the user or test devnets without the correct code. If you are actively developing filecoin and would like to check compatibility of your code with these devnets, you can still run your node on the devnet. This is done by building filecoin with the following command:

FILECOIN_OVERRIDE_BUILD_SHA=<SHA OF CURRENT FILECOIN RELEASE> go run ./build build

This build step will allow your node to present itself as a node on the network with the correct code.

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 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.

Check out the Go-Filecoin code overview for a brief tour of the code.

Community

Here are a few places to get help and connect with the Filecoin community: - Documentation Wiki — for tutorials, troubleshooting, and FAQs - The #fil-dev channel on Filecoin Project Slack or Matrix/Riot - for live help and some dev discussions - Filecoin Community Forum - for talking about design decisions, use cases, implementation advice, and longer-running conversations - GitHub issues - for now, use only to report bugs, and view or contribute to ongoing development. PRs welcome! Please see our contributing guidelines. - Filecoin Project Specification - how Filecoin is supposed to work

Looking for even more? See the full rundown at 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 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:

Created with Sketch.Content is"CC-BY-SA 4.0" licensed
Article On-chain
Article Author

Kauri Team

113

15

1

0 Comments
Related Articles
Bluzelle - A decentralized data cache

Bluzelle is a decentralized data cache with servers available in data centers across multiple regions, and auto-replication. Quick Start 1. Create an NPM Project With NodeJS and NPM installed creating a project is a straight forward process:$ mkdir my-bluzelle-project $ cd my-bluzelle-project $ npm init 2. Install the bluzelle NPM package Run npm install bluzelle to get the latest and greatest Bluzelle sdk \\(see installation for more details\\). 3. Run a simple program Create a file, my-program

Kauri Team

06 Jun 19

Swarm: Distributed Storage Platform and Content Distribution Service

Swarm is a distributed storage platform and content distribution service, a native base layer service of the ethereum web3 stack This article originally appears in the Swarm repository Introduction This guide walks you through understanding, installing, and using Swarm. It also explains how to contribute or ask for help. Swarm is in active development and it is untested in the wild, so use it at your own risk. To interact with Swarm, you will need to use the command line. If you are not comforta

Kauri Team

13 May 19