Installation and Use
Using OpenRank SDK - EigenTrust to generate your first set of rankings.
In this example, we will examine the trust relationships among Alice, Charlie, and Bob. We will use their trust scores for each other and the assumed pre-trust scores given to Alice and Charlie to generate rankings for the three individuals.
Installation
Here's the Github repo.
Parameters
Local Trust | i | From Peer ID: Address of the user initiating the interaction | *(Required) |
j | To Peer ID: Address of the user receiving the interaction | *(Required) | |
v | Value of Interaction: Score/Weight/Value of the interaction | *(Required) | |
Seed Peers (PreTrust) | I | Seed Peers: Address of the Peer | Defaults to using all i in the Local Trust as Seed Peers |
V | Trust Score: Initial trust score for the peer | Defaults to giving all the Preturst members the a common trust score | |
Parameters | Alpha | Pre-trust Strength: Weighting factor for initial trust scores | 0.5 (50%) as the strength |
Input:
In order to use the OpenRank SDK, you will need to provide information regarding local trust and optionally pre-trust values.
Local trust: represents the trust relationships between peers within the network Pre-trust: indicates the initial level of trust assigned to each peer by default.
Both local trust and pre-trust values can be specified either using a CSV file or an array of dictionaries with the following format:
v value cannot be negative or 0.
Sample local trust data:
Sample Local Trust CSV:
In this example, there are three peers: Alice, Charlie, and Bob. Both Alice and Charlie trust Bob by 100, and Alice also trusts Charlie by 75, which is 3/4 of the trust he places in Bob.
Sample Pre-Trust Data:
Here, both Alice and Charlie are pre-trusted by the network, with Charlie being trusted twice as much as Alice.
Running:
To execute the EigenTrust algorithm using the provided input, you can follow these steps:
Output:
Upon execution, the OpenRank SDK will generate rankings based on the provided input. An example of the output is as follows:
Here, the EigenTrust algorithm has distributed the network's trust among the three peers as follows:
Alice receives 22.1% of the total trust.
Bob receives 29.3% of the total trust.
Charlie receives 48.6% of the total trust.
This output provides a clear understanding of how trust is distributed within the network based on the EigenTrust algorithm.
Appendix
Tweaking Alpha: Adjusting Seed trust strength in EigenTrust
The pre-trust input defines the relative ratio by which the network distributes its a priori trust onto trustworthy peers.
You can also tweak the overall absolute strength of the pre-trust. This parameter, named alpha, represents the portion of the EigenTrust output taken from the pre-trust. For example, with alpha of 0.2, the EigenTrust output is a blend of 20% pre-trust and 80% peer-to-peer trust.
The default for alpha is 0.5 (50%). If you re-run EigenTrust using a lower alpha of only 0.01 (1%):
Output Rankings changed due to this
Tips for developers
Choose a data set that could represent peer to peer interactions. For example, onchain attestations, github stars, social network engagement among users, token transfers among EOAs.
Identify a trust heuristic value between peers. For example, value of tokens sent from Alice to Bob (value=$sent), giving an attestation or a github star (value=1).
Create a Local trust matrix from the above two steps. The v1 SDK can support a few million non-zero entries in this matrix.
Choose a few seed peers based on the context of the data set or use case. This would be any known trustworthy users or peers in the graph. Optionally, you can also choose the intenstity of the seed trust in the compute. The v1 defaults to 50% amplification of the seed trust peers in the output score calculation.
Run the compute and view the resulting scores. You can fine tune and iterate the local trust and seed peers based on eyeballing the compute results.
Reach out to us for any help.
Last updated