In this article, the author delves into the Eigentrust algorithm of OpenRank, which is a new technology currently used by Metamask Snaps, Degen tips, and Supercast. As a computational layer, OpenRank can run a variety of reputation graph algorithms, with the eigentrust algorithm being the first introduced. The author shares the need for community-built graphs, key concepts of the algorithm, how it works, and how to create one’s own graph. Additionally, the author teases the upcoming Bytexplorers mission and encourages readers to subscribe for the latest updates.
Most of today’s front-end cryptocurrencies include simple rankings of top tokens based on trading volume, liquidity, minting, points, voting, and so on. If we want to enter the consumer-grade cryptocurrency experience that can surpass today’s Web2 giants, our application needs more than just rankings.
OpenRank is one of the cornerstones that help us achieve this goal and has been used by Metamask Snaps, Degen Tips, and Supercast. OpenRank is a computation layer that can run many reputation graph algorithms, the first of which is the eigentrust algorithm.
In this article, I will introduce the eigentrust algorithm of OpenRank and discuss the following:
The importance of community building maps, and why you need them
The key concepts and working principles of this algorithm
How to create your own chart, refer to the chart I made in the Python notebook
Let’s get started!
Why build recommendation graphs with the community instead of relying solely on your own machine learning team?
When building algorithms and recommendation streams in cryptocurrency, you will soon encounter some data issues:
· Trading involves many levels of operations
The relationship between addresses can become infinitely complex through multiple transactions.
· The address itself contains some identity, and each identity is relevant in different contexts.
All three of the above points are developing at an exponential rate, so let’s call these elements that are constantly rising “context”.
Your small ML team can’t keep up with these endless creativity
You wouldn’t want your backend or data engineering team to deal with these issues, after all, they have products to build. The era of applications having only user and user data structures is over. You no longer have just a simple link, user ID, likes/replies/shares, and post ID, but you can have exchanges, splits, drops, exchanges, stakes, delegations, votes, minting, and so on. Almost every day, there are new ‘operations’ appearing, as well as new chains, new types of wallets, new types of identities, and so on.
I believe that in the coming year, the cryptocurrency industry will develop a graph data science community based on the OpenRank protocol and products.
I have been in the wizard community of Dune for many years, witnessing the powerful force of the community, exceeding the ability of small teams. I have also seen almost every small encryption team transition from ‘yes, we can do this with a node and RDS database independently’ to ‘we need to use data tools built by communities like The Graph and Dune’. For me, creating queries and chart combinations tailored to specific types of recommendations and community adjustments is a similar issue. We need to start collecting and testing charts that can provide recommendation streams on each application, from the Farcaster client to the blockchain explorer.
The concept of a recommendation stream is mimetic and will be eliminated. Users will become curators of content.
In the field of cryptocurrency, users not only want to bring their social graph to different applications, but also want to bring the context hidden in these graphs. If I actively follow the /degen community on Farcaster, I hope to be recommended activities of this community on Zora, Roam.xyz, or OnceUpon, and I also hope to be able to switch the recommendation to the context of another community I participate in, such as artblocks collectors. The future will be the era of users discovering and choosing their own feeds, rather than being limited to a specific group or channel function on a single platform.
How does OpenRank’s Eigentrust algorithm work?
Eigentrust algorithm is similar to PageRank, ranking nodes in a graph network. The difference is that it focuses on capturing complex peer-to-peer relationships as a distribution of trust. It was initially designed to allocate trust scores in file-sharing networks. In the cryptocurrency field, you can imagine using it to proxy high-quality governance delegates or identify trustworthy smart contracts.
Here is the formula for Eigentrust:
There are two key inputs above: pre-trusted nodes and local trust graph. ‘P’ is your pre-trust, ‘S’ is your local trust.
· Localtrust: This is the measurement of interactions between two nodes when node “i” passes some form of value to node “j”. This may include token transfers, proofs, voting responses/likes, etc.
· Pretrust: This is the “seed” selection of nodes in the network that should be more trustworthy in your chosen network.
· 「c」: This constant (between 0 and 1) is the weight of the trust value between the overall local trust graph and the pre-trusted seed. The interaction graph usually has a power-law distribution, so a higher pre-trust weight helps to normalize the distribution of the final ranking values.
If these mathematical formulas are not easy to understand, you can analogize them to social graphs like Twitter, where influences such as followers, likes, replies, etc. are usually concentrated on a few people, resulting in power-law dynamics. By setting a group of influential individuals and choosing a constant value of ‘c’ as 0.5 or higher, in practice, the people interacting with these trusted individuals will inherit half the value of that influence. This is a method to more evenly balance and distribute trust scores in a network.
What does this have to do with choosing any context and creating any recommendation stream?
Assuming you want to sort 10,000 funding proposals in a recommendation stream. Based on a set of voting interactions (local trust) and a set of trusted voters you choose (pre-trust), you can rank all voters and proposers by value. You can select your pre-trusted voters by choosing the top 10 voters you delegate to vote in multiple DAOs. Eigentrust will run based on these two inputs and give you a larger list of voters ranked in the graph according to the trust inherited from pre-trusted nodes.
In this way, you can now use this ranking value list to weigh real-time governance proposals for more personalized recommendation flow!
This may still be too abstract, so I will explain it with specific code examples in the next section. Remember, OpenRank handles the computation and storage of these Eigentrust graphs, and recommends that you can use the recommended stream of outputs. All you need to do is decide on the input for pre-trust and local trust.
How to use OpenRank to build Eigentrust graph?
Ultimate Goal
In this example, I want to provide a subscription stream for recommended contracts based on the user wallet of Farcaster/base (Farcaster is a Twitter-like application). The output is just a list containing ids and values. In my chart, each id is associated with a Farcaster user id (fid).
Data Source
After creating the ranking chart, we generated this recommended stream based on their major contract interactions last week:
Data Source
You can check the dashboard to see other recommended streams created from this graph, such as NFT minting, DEX token trading, and Farcaster channel activities.
Code Implementation
Now that you have seen the target, let’s talk about how I created this ranking chart.
All the code for this example can be found in the hex.tech notebook, and if you prefer to run it locally, you can also use jupyter notebook.
First, I created two queries for our pre-trust and local trust separately:
The first query is our ‘pre-trusted node’. This query outputs the top users in the /base channel based on the interactions received (likes, retweets, replies). My formula is (likes + 3 retweets + 10 replies). We will take the top 100 IDs from this query as our trusted nodes.
Data Source
The second query is used to track on-chain interactions between nodes using the linked addresses of users in the /base channel. Since the subscription flow recommends on-chain operations, I want to make sure to select an interaction graph based on on-chain interaction volume. Using the dollar value transferred between nodes is a good general proxy—I track stablecoins and ETH transfers on Optimism, Base, and the Ethereum mainnet.
Data Source
Analyze the input graph and test the output Eigentrust graph
Now that we have pre-trusted nodes and local trust graphs, let’s look at some summary statistics. In the /base channel, 65,755 users have transferred tokens to others in the channel, and 19% of the graph can be traversed from our pre-trusted node (i.e., connected nodes). This percentage may vary depending on the Sybil level of local trust data in the graph. Token transfers may be high signal, but they could also be malicious swiping, so it’s not surprising that most of the graph is unconnected.
After confirming that the input data size and connections are reasonable, we can run and save our Eigentrust graph. I saved my graph as id “base_transfer_50” - you can see that only 10 lines of code are needed to train the graph. You can think of the OpenRank SDK as the scikit-learn for encryption graph models.
Do you remember the constant “c” in the formula above? Let’s do a grid search on different values of c (which I call alpha) and different sizes of pre-trusted seed to see which one can give us the highest logarithmic normal trust score and the highest coverage rate.
There are many trade-offs here, and there is no one best value to choose. If you want to recommend strong diversity, high regularization and coverage are a good choice, but for high-risk governance voting, you may actually want a higher level of trust. Here you can use your intuition.
From here, we can insert the value into the subscription query linked at the start of the dashboard in Dune to get the contract interaction flow of trusted users in the /base channel. This subjective recommendation output helps us better connect previous general metrics with our intuitive expectations for the quality of recommendation output.
Done! You can immediately use this Dune API to power any of your applications.
Learn to build your own OpenRank Eigentrust graph
Are you ready to get your hands dirty? You can fork my notebook and try it yourself, all the necessary links are as follows:
·OpenRank Docs
·Python SDK repo
·Python Notebook
·Dune feed dashboard
I will conduct a Bytexplorers mission within the next month, where we will compete to create the best subscription flow chart for top-tier encryption applications.
This page may contain third-party content, which is provided for information purposes only (not representations/warranties) and should not be considered as an endorsement of its views by Gate, nor as financial or professional advice. See Disclaimer for details.
In-depth exploration of the Eigentrust algorithm of OpenRank: How to build a social computing layer?
Author: Andrew Hong
Compiled by: Ladyfinger, BlockBeats
Editor’s note:
In this article, the author delves into the Eigentrust algorithm of OpenRank, which is a new technology currently used by Metamask Snaps, Degen tips, and Supercast. As a computational layer, OpenRank can run a variety of reputation graph algorithms, with the eigentrust algorithm being the first introduced. The author shares the need for community-built graphs, key concepts of the algorithm, how it works, and how to create one’s own graph. Additionally, the author teases the upcoming Bytexplorers mission and encourages readers to subscribe for the latest updates.
Most of today’s front-end cryptocurrencies include simple rankings of top tokens based on trading volume, liquidity, minting, points, voting, and so on. If we want to enter the consumer-grade cryptocurrency experience that can surpass today’s Web2 giants, our application needs more than just rankings.
OpenRank is one of the cornerstones that help us achieve this goal and has been used by Metamask Snaps, Degen Tips, and Supercast. OpenRank is a computation layer that can run many reputation graph algorithms, the first of which is the eigentrust algorithm.
In this article, I will introduce the eigentrust algorithm of OpenRank and discuss the following:
The importance of community building maps, and why you need them
The key concepts and working principles of this algorithm
How to create your own chart, refer to the chart I made in the Python notebook
Let’s get started!
Why build recommendation graphs with the community instead of relying solely on your own machine learning team?
When building algorithms and recommendation streams in cryptocurrency, you will soon encounter some data issues:
· Trading involves many levels of operations
The relationship between addresses can become infinitely complex through multiple transactions.
· The address itself contains some identity, and each identity is relevant in different contexts.
All three of the above points are developing at an exponential rate, so let’s call these elements that are constantly rising “context”.
Your small ML team can’t keep up with these endless creativity
You wouldn’t want your backend or data engineering team to deal with these issues, after all, they have products to build. The era of applications having only user and user data structures is over. You no longer have just a simple link, user ID, likes/replies/shares, and post ID, but you can have exchanges, splits, drops, exchanges, stakes, delegations, votes, minting, and so on. Almost every day, there are new ‘operations’ appearing, as well as new chains, new types of wallets, new types of identities, and so on.
I believe that in the coming year, the cryptocurrency industry will develop a graph data science community based on the OpenRank protocol and products.
I have been in the wizard community of Dune for many years, witnessing the powerful force of the community, exceeding the ability of small teams. I have also seen almost every small encryption team transition from ‘yes, we can do this with a node and RDS database independently’ to ‘we need to use data tools built by communities like The Graph and Dune’. For me, creating queries and chart combinations tailored to specific types of recommendations and community adjustments is a similar issue. We need to start collecting and testing charts that can provide recommendation streams on each application, from the Farcaster client to the blockchain explorer.
The concept of a recommendation stream is mimetic and will be eliminated. Users will become curators of content.
In the field of cryptocurrency, users not only want to bring their social graph to different applications, but also want to bring the context hidden in these graphs. If I actively follow the /degen community on Farcaster, I hope to be recommended activities of this community on Zora, Roam.xyz, or OnceUpon, and I also hope to be able to switch the recommendation to the context of another community I participate in, such as artblocks collectors. The future will be the era of users discovering and choosing their own feeds, rather than being limited to a specific group or channel function on a single platform.
How does OpenRank’s Eigentrust algorithm work?
Eigentrust algorithm is similar to PageRank, ranking nodes in a graph network. The difference is that it focuses on capturing complex peer-to-peer relationships as a distribution of trust. It was initially designed to allocate trust scores in file-sharing networks. In the cryptocurrency field, you can imagine using it to proxy high-quality governance delegates or identify trustworthy smart contracts.
Here is the formula for Eigentrust:
There are two key inputs above: pre-trusted nodes and local trust graph. ‘P’ is your pre-trust, ‘S’ is your local trust.
· Localtrust: This is the measurement of interactions between two nodes when node “i” passes some form of value to node “j”. This may include token transfers, proofs, voting responses/likes, etc.
· Pretrust: This is the “seed” selection of nodes in the network that should be more trustworthy in your chosen network.
· 「c」: This constant (between 0 and 1) is the weight of the trust value between the overall local trust graph and the pre-trusted seed. The interaction graph usually has a power-law distribution, so a higher pre-trust weight helps to normalize the distribution of the final ranking values.
If these mathematical formulas are not easy to understand, you can analogize them to social graphs like Twitter, where influences such as followers, likes, replies, etc. are usually concentrated on a few people, resulting in power-law dynamics. By setting a group of influential individuals and choosing a constant value of ‘c’ as 0.5 or higher, in practice, the people interacting with these trusted individuals will inherit half the value of that influence. This is a method to more evenly balance and distribute trust scores in a network.
What does this have to do with choosing any context and creating any recommendation stream?
Assuming you want to sort 10,000 funding proposals in a recommendation stream. Based on a set of voting interactions (local trust) and a set of trusted voters you choose (pre-trust), you can rank all voters and proposers by value. You can select your pre-trusted voters by choosing the top 10 voters you delegate to vote in multiple DAOs. Eigentrust will run based on these two inputs and give you a larger list of voters ranked in the graph according to the trust inherited from pre-trusted nodes.
In this way, you can now use this ranking value list to weigh real-time governance proposals for more personalized recommendation flow!
This may still be too abstract, so I will explain it with specific code examples in the next section. Remember, OpenRank handles the computation and storage of these Eigentrust graphs, and recommends that you can use the recommended stream of outputs. All you need to do is decide on the input for pre-trust and local trust.
How to use OpenRank to build Eigentrust graph?
Ultimate Goal
In this example, I want to provide a subscription stream for recommended contracts based on the user wallet of Farcaster/base (Farcaster is a Twitter-like application). The output is just a list containing ids and values. In my chart, each id is associated with a Farcaster user id (fid).
Data Source
After creating the ranking chart, we generated this recommended stream based on their major contract interactions last week:
Data Source
You can check the dashboard to see other recommended streams created from this graph, such as NFT minting, DEX token trading, and Farcaster channel activities.
Code Implementation
Now that you have seen the target, let’s talk about how I created this ranking chart.
All the code for this example can be found in the hex.tech notebook, and if you prefer to run it locally, you can also use jupyter notebook.
First, I created two queries for our pre-trust and local trust separately:
The first query is our ‘pre-trusted node’. This query outputs the top users in the /base channel based on the interactions received (likes, retweets, replies). My formula is (likes + 3 retweets + 10 replies). We will take the top 100 IDs from this query as our trusted nodes.
Data Source
The second query is used to track on-chain interactions between nodes using the linked addresses of users in the /base channel. Since the subscription flow recommends on-chain operations, I want to make sure to select an interaction graph based on on-chain interaction volume. Using the dollar value transferred between nodes is a good general proxy—I track stablecoins and ETH transfers on Optimism, Base, and the Ethereum mainnet.
Data Source
Analyze the input graph and test the output Eigentrust graph
Now that we have pre-trusted nodes and local trust graphs, let’s look at some summary statistics. In the /base channel, 65,755 users have transferred tokens to others in the channel, and 19% of the graph can be traversed from our pre-trusted node (i.e., connected nodes). This percentage may vary depending on the Sybil level of local trust data in the graph. Token transfers may be high signal, but they could also be malicious swiping, so it’s not surprising that most of the graph is unconnected.
After confirming that the input data size and connections are reasonable, we can run and save our Eigentrust graph. I saved my graph as id “base_transfer_50” - you can see that only 10 lines of code are needed to train the graph. You can think of the OpenRank SDK as the scikit-learn for encryption graph models.
Do you remember the constant “c” in the formula above? Let’s do a grid search on different values of c (which I call alpha) and different sizes of pre-trusted seed to see which one can give us the highest logarithmic normal trust score and the highest coverage rate.
There are many trade-offs here, and there is no one best value to choose. If you want to recommend strong diversity, high regularization and coverage are a good choice, but for high-risk governance voting, you may actually want a higher level of trust. Here you can use your intuition.
From here, we can insert the value into the subscription query linked at the start of the dashboard in Dune to get the contract interaction flow of trusted users in the /base channel. This subjective recommendation output helps us better connect previous general metrics with our intuitive expectations for the quality of recommendation output.
Done! You can immediately use this Dune API to power any of your applications.
Learn to build your own OpenRank Eigentrust graph
Are you ready to get your hands dirty? You can fork my notebook and try it yourself, all the necessary links are as follows:
·OpenRank Docs
·Python SDK repo
·Python Notebook
·Dune feed dashboard
I will conduct a Bytexplorers mission within the next month, where we will compete to create the best subscription flow chart for top-tier encryption applications.