Go to file
Alexey Proshutinskiy 7ee8cacc03 fix
2022-01-17 02:35:59 +03:00
.circleci fix ci 2022-01-11 17:07:10 +03:00
.github Fix CI recipes (#27) 2021-11-12 17:00:37 +03:00
admin pr fixes 2022-01-17 02:34:05 +03:00
aqua fix 2022-01-17 02:35:59 +03:00
builtin-package fix 2022-01-17 02:35:59 +03:00
example pr fixes 2022-01-17 02:34:05 +03:00
keypair Fix revocations logic (#34) 2021-12-13 19:40:16 +03:00
local-network pr fixes 2022-01-17 02:34:05 +03:00
service pr fixes 2022-01-17 02:34:05 +03:00
src pr fixes 2022-01-17 02:34:05 +03:00
.gitignore Trust Graph: implement WASM built-in (#18) 2021-11-12 16:19:16 +03:00
Cargo.lock pr fixes 2022-01-17 02:34:05 +03:00
Cargo.toml Fix revocations logic (#34) 2021-12-13 19:40:16 +03:00
README.md pr fixes 2022-01-17 02:34:05 +03:00
rust-toolchain.toml Trust Graph: implement WASM built-in (#18) 2021-11-12 16:19:16 +03:00

Trust Graph

Trust Graph is network-wide peer relationship layer. It's designed to be used to prioritize resources and control permissions in open networks. Being a decentralized graph of relationships, basically a Web of Trust, Trust Graph is distributed among all network peers.

Specifically, Trust Graph is used to prioritize connections from known peers to counteract Sybil attacks while still keeping network open by reserving resources for unknown peers.

At the same time, Trust Graph can be used at the application level in various ways such as prioritization of service execution on authorized peers or to define an interconnected subnetwork among peers of a single protocol.

How to Use it in TypeScript

See example:

API

High-level API is defined in the trust-graph-api.aqua module.

Directory structure

  • src is the main project with all trust graph logic

  • keypair directory is an abstracted cryptographical layer (key pairs, public keys, signatures, etc.)

  • service is a package that provides marine API and could be compiled to a Wasm file. It is uses SQLite as storage

  • example is a js script that shows how to use Trust Graph to label peers

  • builtin-package contains blueprint, configs and scripts for generation builtin package locally or via CI

  • admin is a js script used to generate builtin-package/on_start.json which contains certificates for Fluence Labs nodes

Learn Aqua

How to use in Aqua

import "@fluencelabs/trust-graph/trust-graph-api.aqua"
import "@fluencelabs/trust-graph/trust-graph.aqua"

func my_function(peer_id: string) -> u32:
    on HOST_PEER_ID:
        result <- get_weight(peer_id)
    <- result

How to use is js

  1. Add the following to your dependencies

    • @fluencelabs/trust-graph
    • @fluencelabs/aqua
    • @fluencelabs/aqua-lib
    • @fluencelabs/fluence
    • @fluencelabs/fluence-network-environment
  2. Import dependencies

    import * as tg from "./generated/export";
    import { Fluence, KeyPair } from "@fluencelabs/fluence";
    import { krasnodar, Node } from "@fluencelabs/fluence-network-environment";
    
  3. Add root and issue root trust.

  4. For now, trusts/revocations can only be signed by client's private key.