Skip to main content

Discovering the Most Trusted Accounts

Time to complete: 45 minutes Difficulty: Intermediate

Why You'd Need This​

Building trust graphs, recommendation systems, or expert finders? This tutorial shows you how to identify the most trusted and active participants in the Intuition ecosystem.

Use cases:

  • Expert discovery platforms
  • Trust-weighted voting systems
  • Recommendation engines
  • Influencer identification
  • Reputation dashboards

What You'll Learn​

Learn how to leverage the Intuition GraphQL API to find and rank the ecosystem's most trusted accounts based on their positions, stakes, and activity patterns.

Understanding the Progression​

  1. Get top 20 accounts ranked by total shares across all positions, showing the most trusted accounts based on cumulative stakes.
  2. Get detailed information for a given account including all positions and atoms created.
  3. Find top 20 individual positions by share amount, showing which accounts hold the largest single stakes.

Query

query GetTrustedAccounts($limit: Int = 20) {
  accounts(
    limit: $limit
    order_by: [{ positions_aggregate: { sum: { shares: desc } } }]
    where: {
      positions_aggregate: {
        count: { predicate: { _gt: 0 } }
      }
    }
  ) {
    id
    label
    image
    positions_aggregate {
      aggregate {
        count
        sum {
          shares
        }
      }
    }
    positions(
      limit: 10
      order_by: [{ shares: desc }]
    ) {
      id
      shares
      created_at
      vault {
        term_id
        current_share_price
        market_cap
        term {
          atom {
            term_id
            label
            image
          }
        }
      }
    }
  }
}

Variables

Click "Run Query" to execute the GraphQL query and see results

UI Integration Example​

Display trusted accounts in your application:

import { request, gql } from 'graphql-request'

const GET_TRUSTED_ACCOUNTS = gql`
query GetTrustedAccounts($limit: Int = 20) {
accounts(
limit: $limit
order_by: [{ positions_aggregate: { sum: { shares: desc } } }]
where: {
positions_aggregate: {
count: { predicate: { _gt: 0 } }
}
}
) {
id
label
image
positions_aggregate {
aggregate {
count
sum { shares }
}
}
}
}
`

export function TrustedAccountsWidget() {
const [accounts, setAccounts] = useState([])

useEffect(() => {
async function fetchAccounts() {
const data = await request(
'https://api.intuition.systems/graphql',
GET_TRUSTED_ACCOUNTS,
{ limit: 10 }
)
setAccounts(data.accounts)
}
fetchAccounts()
}, [])

return (
<div className="trusted-accounts">
<h3>Most Trusted Accounts</h3>
{accounts.map((account, i) => (
<div key={account.id} className="account-item">
<span className="rank">#{i + 1}</span>
<img src={account.image} alt={account.label} />
<div>
<div className="name">{account.label || account.id.slice(0, 10)}</div>
<div className="stats">
{account.positions_aggregate.aggregate.count} positions
β€’ {parseFloat(account.positions_aggregate.aggregate.sum.shares).toFixed(2)} total shares
</div>
</div>
</div>
))}
</div>
)
}

Next Steps​

Resources​