Go to file
ljedrz 4c120779a2 fix: return errors for some extra DHT issues
Signed-off-by: ljedrz <ljedrz@gmail.com>
2020-09-21 12:44:38 +02:00
.github chore: rename test_dht_with_go to test_go_interop 2020-09-07 17:14:41 +02:00
bitswap chore: remove a dead protocol upgrade test 2020-09-18 10:32:36 +02:00
conformance Enabling pinned blocks test 2020-09-16 22:52:07 -04:00
examples refactor: reuse an existing resolve function 2020-09-02 10:07:14 +02:00
http fix: remove the direct hyper dep from http 2020-09-18 11:02:04 +02:00
src fix: return errors for some extra DHT issues 2020-09-21 12:44:38 +02:00
tests test: add unit tests for the Node topologies 2020-09-16 14:48:51 +02:00
unixfs Remove Default full path 2020-09-08 09:21:32 -03:00
.gitignore Remove the / before target can help ignore build files 2020-06-11 20:52:48 -07:00
build.rs chore: merge and adapt the libipld dependency 2020-08-10 13:15:11 +02:00
Cargo.lock fix: remove the direct hyper dep from http 2020-09-18 11:02:04 +02:00
Cargo.toml chore: update libp2p 2020-09-11 17:01:38 +02:00
CODE_OF_CONDUCT.md Create CODE_OF_CONDUCT.md 2020-03-05 18:35:03 -05:00
CONTRIBUTING.md Update README.md 2020-08-21 11:28:36 -04:00
LICENSE-APACHE switch license from isc to mit/apl2.0 2020-02-23 17:18:08 +01:00
LICENSE-MIT switch license from isc to mit/apl2.0 2020-02-23 17:18:08 +01:00
README.md docs: update README, remove old links 2020-09-16 16:14:38 +02:00


Rust IPFS

The Interplanetary File System (IPFS), implemented in Rust

Financial Contributors on Open Collective standard-readme compliant Back on OpenCollective Matrix Discord

Table of Contents

Description

This repository contains the crates for the IPFS core implementation which includes a blockstore, a libp2p integration which includes DHT content discovery and pubsub support, and HTTP API bindings. Our goal is to leverage both the unique properties of Rust to create powerful, performant software that works even in resource-constrained environments, while also maximizing interoperability with the other "flavors" of IPFS, namely JavaScript and Go.

Project Status - Alpha

You can see details about what's implemented, what's not, and also learn about other ecosystem projects, at Are We IPFS Yet?

For more information about IPFS see: https://docs.ipfs.io/introduction/overview/

Install

Rust IPFS depends on protoc and openssl.

Dependencies

First, install the dependencies.

With apt:

# apt-get install protobuf-compiler libssl-dev zlib1g-dev

With yum

# yum install protobuf-compiler libssl-dev zlib1g-dev

Install rust-ipfs itself

The rust-ipfs binaries can be built from source. Our goal is to always be compatible with the stable release of Rust.

$ git clone https://github.com/rs-ipfs/rust-ipfs && cd rust-ipfs
$ cargo build --workspace

You will then find the binaries inside of the project root's /target/debug folder.

Note: binaries available via cargo install is coming soon.

Getting started

use tokio::task;
use futures::join;
use ipfs::{make_ipld, Ipfs, IpfsPath, Ipld, Types, UninitializedIpfs};

#[tokio::main]
async fn main() {
    tracing_subscriber::fmt::init();

    // Start daemon and initialize repo
    let (ipfs, fut): (Ipfs<Types>, _) = UninitializedIpfs::default().await.start().await.unwrap();
    task::spawn(fut);

    // Create a DAG
    let f1 = ipfs.put_dag(make_ipld!("block1"));
    let f2 = ipfs.put_dag(make_ipld!("block2"));
    let (res1, res2) = join!(f1, f2);
    let root = make_ipld!([res1.unwrap(), res2.unwrap()]);
    let cid = ipfs.put_dag(root).await.unwrap();
    let path = IpfsPath::from(cid);

    // Query the DAG
    let path1 = path.sub_path("0").unwrap();
    let path2 = path.sub_path("1").unwrap();
    let f1 = ipfs.get_dag(path1);
    let f2 = ipfs.get_dag(path2);
    let (res1, res2) = join!(f1, f2);
    println!("Received block with contents: {:?}", res1.unwrap());
    println!("Received block with contents: {:?}", res2.unwrap());

    // Exit
    ipfs.exit_daemon();
}

More usage examples coming soon 👍

Roadmap

Special thanks to the Web3 Foundation and Protocol Labs for their devgrant support.

Completed Work

  • Project Setup
  • Testing Setup
    • Conformance testing
  • HTTP API Scaffolding
  • UnixFS Support
  • /pubsub/{publish,subscribe,peers,ls}
  • /swarm/{connect,peers,addrs,addrs/local,disconnect}
  • /id
  • /version
  • /shutdown
  • /block/{get,put,rm,stat}
  • /dag/{put,resolve}
  • /refs and /refs/local
  • /bitswap/{stat,wantlist}
  • /cat
  • /get
  • /resolve

Work in Progress

  • /bootstrap
  • /dht
  • interop testing

Work still required

  • /name
  • /ping
  • /key
  • /config
  • /stats
  • /files (regular and mfs)
  • a few other miscellaneous endpoints not enumerated here

Maintainers

Rust IPFS was originally authored by @dvc94ch and now actively maintained by @koivunej, and @aphelionz. Special thanks is given to Protocol Labs, Equilibrium, and MRH.io.

Its been noted that the Rust-IPFS name and popularity may serve its organization from a "first-mover" perspective. However, alternatives with different philosophies do exist, and we believe that supporting a diverse IPFS community is important and will ultimately help produce the best solution possible.

  • rust-ipfs-api - A Rust client for an existing IPFS HTTP API. Supports both hyper and actix.
  • ipfs-embed - An implementation based on sled
  • rust-ipld - Basic rust ipld library supporting dag-cbor, dag-json and dag-pb formats.
  • PolkaX's own rust-ipfs
  • Parity's rust-libp2p, which does a lot the of heavy lifting here

If you know of another implementation or another cool project adjacent to these efforts, let us know!

Contributing

See the contributing docs for more info.

You can also back the project financially by reaching out or by becoming a backer on OpenCollective

Contributors

Code Contributors

This project exists thanks to all the people who contribute. [Contribute].

Financial Contributors

Become a financial contributor and help us sustain our community. [Contribute]

Individuals

Organizations

Support this project with your organization. Your logo will show up here with a link to your website. [Contribute]

License

Dual licensed under MIT or Apache License (Version 2.0). See LICENSE-MIT and LICENSE-APACHE for more details.

Trademarks

The Rust logo and wordmark are trademarks owned and protected by the Mozilla Foundation. The Rust and Cargo logos (bitmap and vector) are owned by Mozilla and distributed under the terms of the Creative Commons Attribution license (CC-BY).