Skip to content

Filecoin Quickstart

Wanna build apps on Filecoin using Truffle? You're in the right place.

Ganache

Looking to set up Filecoin-flavored Ganache? Head over to the Ganache-specific documentation.

Table of Contents

  1. Getting set up
  2. Installing Truffle
  3. Using the Filecoin Truffle Box
  4. Further Resources

Getting Set Up

Requirements

  • NodeJS v12.13.0 or later
  • Windows, Linux or Mac OS X

Installing Truffle

Truffle's Filecoin integration works out of the box with the latest Truffle, so no need to install any special versions for it.

$ npm install -g truffle

Using the Filecoin Truffle Box

This quick start uses an already-created project to provide the base Truffle project structure and example contracts.

In your workspace directory, run the following commands:

$ mkdir filecoin-example
$ cd filecoin-example
$ truffle unbox filecoin

More specific usage information about the Filecoin Truffle Box can be found in its README.

Preserving files to IPFS and Filecoin

Truffle offers builtin functionality to preserve any files and directories to IPFS, Filecoin or Textile Buckets through the truffle preserve command. This works with local IPFS / Filecoin nodes, remote nodes and Filecoin-flavored Ganache! Besides this, truffle preserve also has support for Textile Buckets, which offers a smooth user experience around IPFS and Filecoin.

$ truffle preserve ./stuff --ipfs
$ truffle preserve ./stuff --filecoin
$ truffle preserve ./stuff --buckets

For extensive documentation on truffle preserve refer to the main Truffle documentation.

Further Resources

If you've reached this point, you now have a Truffle project that lets you interact with the Filecoin network. Congrats! This is a great start, but there's still much to learn. We suggest you check out the following resources to learn more about Filecoin, Textile, Ganache, and the entire Truffle Suite: