Last modified: Fri Aug 16 2019 11:27:04 GMT+0000 (Coordinated Universal Time)

How do I evaluate trust clues?

Trust is important in everyday life and even more on a decentralized platform. In this tutorial, you will learn how you can evaluate if you trust someone on the Winding Tree platform.

Requirements

Step by step

Trust clues

We consider every turst clue to be a standalone piece of software, potentially provided by a third party that would like to participate in the system.

Bear in mind that having a source code and documentation of a trust clue tells you nothing about an actual instance of it. There might be multiple environments - for testing or for production use - with different setups. So be careful when configuring your tools and APIs and make sure that you are always using the appropriate setup.

Our tooling might come preconfigured, but always check before running anything in production.

Regardless of the base implementation (smart contract, web service), every clue should offer a Javascript wrapper that adheres to the following interface with which we are able to plug it into our tooling. It might be possible to interact with a clue in a different way as well and that is fine.

interface TrustClueInterface {
  // Returns metadata about the clue not limited to name and description
  getMetadata(): Promise<{name: string, description: string}>,
  // Returns raw value of the clue for given address
  getValueFor(address: string): Promise<any>,
  // Returns an interpreted value of the clue
  interpretValueFor(address: string): Promise<boolean | number | string>
}

The interpret part is there to allow the users of every clue to set their own interpretation rules. For example, for somebody, deposit of 100 LIF might be enough, but somebody aiming for a more luxurious segment might require a deposit of 3000 LIF or even millions.

LIF deposit

LIF Deposit is a smart contract that can accommodate funds from interested parties for some amount of time. Esentially, the parties are telling the world that they are serious about LIF and they don't mind having their funds locked while they participate in the platform.

Funds can be withdrawn at any time, but there's a fixed delay between declaring the intent of withdrawal and the actual possibility to withdraw the funds. This should prevent people from rapidly depositing and withdrawing funds in a potential scam scenario.

The smart contract intentionally does not impose any limits or levels as different use cases might require different deposited amounts of funds.

You can read a thorough tutorial on using Lif Deposit in our Getting Started guide.

Curated list

Curated list is a smart contract that is just a simple list of addresses maintained by the contract owner.

It is meant more as a simple example than something really useful, but there might be use cases where this basic solution might come in handy.

Tooling support

As said, every clue should provide a Javascript wrapper, so we can easily integrate the clues into our tooling. Our Javascript library offers a TrustClueClient class that contains some convenience methods for accessing and evaluating multiple clues.

During the library configuration, you pass the clues configuration that contains factory methods for all of your selected clues. The factory methods accept options from which probably the most important is the interpret method where you tell the library how to evaluate an actual value returned by the clue. In case of the LIF deposit, the value would be the amount of LIFs and your interpret method would contain an amount of LIF required to evaluate the address as trustworthy.

const { WtJsLibs } = require('@windingtree/wt-js-libs');
const { TrustClueCuratedList } = require('@windingtree/trust-clue-curated-list');

const libs = WtJsLibs.createInstance({
  trustClueOptions: {
    provider: 'http://localhost:8545',
    clues: {
      'curated-list': {
        options: {
          address: '0x...',
          provider: 'http://localhost:8545',
          interpret: (v) => !!v,
        },
        create: async (options) => {
          return new TrustClueCuratedList(options);
        },
      },
    }
  },
});

Read API support

The Javascript library is used in the Read API as well. The clues are part of the API configuration available to you via environment variables.

The API then for every hotel evaluates if its guarantor can be trusted. If it can be, the API passes the data to its clients as you'd expect. If the clues suggest that the guarantor is not trustworthy, the API clients never see a hotel guaranteed by that address.

This can be turned off as a whole, or on a clue-by-clue basis.