Nice! I understand that this is not GraphQL 101, but some example queries for the things you…
Stoicho Monev
3

List out all accounts who trust USD from issuer X

query {
allTrustlines(
filter: {
assetcode: {equalTo: "USD"},
issuer: {equalTo: "GCNVBFN3GLYI4YXR5CW7MKIVN2UIMMJOKNVB7PRJG7ZDOHSREL6KTY2T"},
}
) {
nodes {
accountid
balance
}
}
}

Show me all the trustlines for issuer X

query {
allTrustlines(
filter: {
issuer: {equalTo: "GCNVBFN3GLYI4YXR5CW7MKIVN2UIMMJOKNVB7PRJG7ZDOHSREL6KTY2T"}
}
) {
nodes {
assetcode
tlimit
}
}
}

Which accounts haven’t yet set an inflation destination?

query {
allAccounts(
first: 10
filter: {
inflationdest: {isNull: true}
}
) {
totalCount
nodes {
accountid
balance
inflationdest
}
pageInfo {
endCursor
startCursor
hasPreviousPage
hasNextPage
}
}
}

List all accounts ordered by their XLM volume

query {
allAccounts(
first: 10
orderBy: BALANCE_DESC
) {
totalCount
nodes {
accountid
balance
}
pageInfo {
endCursor
startCursor
hasPreviousPage
hasNextPage
}
}
}

Rank accounts based on their level of “trust” throughout the network

This would be a more involved example as you’d need to determine what trust actually meant for your use case. In my mind let’s say some account was offering you a fiat or standard but non native asset. A USD, BTC or LOAN token. Token names are not unique, it’s a pair of both the asset name and the issuer address. Anyone can issue a USD, BTC, XLM or LOAN asset, it’s only if you trust both the asset and the issuer that you should actually accept anything from anyone. One way to test that trust level or at least measure it would be to rank asset issuers based on the number of other accounts who trust that asset. It’s not a bullet proof solution as a bad actor could create thousands of “fake” accounts and simply create a trustline back to their fraudulent issuer account. You’d likely want to test / rank by number of trustlines as well as a volume of activity / history as well as duration or lifespan of an account. Giving preference or greater weight to accounts which were created before the issuer account in question but who now trust the asset / issuer of the account in question.

This obviously wouldn’t be a single query but rather a service mixing several queries together and parsing the responses in a meaningful manner to return a sort of risk level for any given asset or issuer.

A service like this would actually be pretty simple to make but incredibly useful. Enter an asset and get the most trusted issuer for that asset as a response. Enter an issuer and get their risk value back to test how trustworthy they are.