Skip to main content
Version: Next

Hopr Channels "monte rosa" Subgraph Entities & Sample Queries

Account

FieldTypeDescription
idBytes!Unique identifier for the account
publicKeyBytesPublic key associated with the account
multiaddr[Bytes!]!A list of multi-addresses associated with the account
fromChannels[Channel!]!Channels where the account is the source
toChannels[Channel!]!Channels where the account is the destination
fromChannelsCountBigInt!Total number of outgoing channels associated with the account
toChannelsCountBigInt!Total number of incoming channels associated with the account
hasAnnouncedBoolean!Indicates whether the account has set a multi-address for others to use when establishing channels with it
balanceBigDecimal!Sum of the channel balances where the account is the source
isActiveBoolean!Indicates whether the account has at least one open channel
openChannelsCountBigInt!Number of active channels associated with the account

StatusSnapshot

FieldTypeDescription
idString!Tx hash - tx index
channelChannel!Channel at snapshot
statusChannelStatus!Status of the channel at the time the snapshot was taken
timeStampBigInt!Timestamp of the snapshot

Ticket

FieldTypeDescription
idString!Channel epoch - ticket epoch - ticket index
channelChannel!Channel in which the ticket was opened
nextCommitmentBytes!Next commitment that will be made in the channel
ticketEpochBigInt!Epoch in which the ticket was created
ticketIndexBigInt!Index of the ticket within the epoch
proofOfRelaySecretBytes!Proof of the relay secret
amountBigDecimal!Amount of funds that were committed to the ticket
winProbBigInt!Win probability for ticket
signatureBytes!Signature that was used to sign the ticket

Channel

FieldTypeDescription
idBytes!Tx hash - tx index
sourceAccount!Account that opened the channel
destinationAccount!Account that the channel is connected to
balanceBigDecimal!Current balance of the channel
commitmentBytes!Current commitment for the channel
channelEpochBigInt!Epoch in which the channel was created
ticketEpochBigInt!Epoch in which the tickets for this channel can be created
ticketIndexBigInt!Index of the next ticket to be created for the channel
statusChannelStatusCurrent status of the channel, such as open, closed, or settled
commitmentHistory[Bytes!]!History of commitments made for the channel
statusHistory[StatusSnapshot!]!History of status changes for the channel
lastOpenedAtBigInt!History of status changes for the channel
lastClosedAtBigInt!Timestamp when the channel was last closed
tickets[Ticket!]!Tickets associated with this channel
redeemedTicketCountBigInt!Number of tickets that have been redeemed for this channel

NetworkRegistry

FieldTypeDescription
idBytes!Account that registered nodes
registeredPeersString!List of HOPR nodes (or peers) registered by the account
eligibilityBoolean!Indicates if the account is eligible

Sample Queries

Below are some sample queries you can use to gather information from the HOPR Channel subgraph.

You can build your own queries using a GraphQL Explorer and enter your endpoint to limit the data to exactly what you need.

Each entity has a plural version and a singular version. When querying for a single record response (e.g. account), you will need to supply the id for the entity. When querying for a list of responses (e.g. accounts), you may add filters using the 'where' clause.

Channels

Description: This query returns the channel status and epoch where redeemed ticket count is greater than 1.

{
channels(where: { redeemedTicketCount_gte: "1" }) {
id
channelEpoch
redeemedTicketCount
status
}
}

Snapshot

Description: This query returns the snapshot of channels that have a 'closed' status.

{
statusSnapshots(where: { status: CLOSED }) {
id
status
timestamp
channel {
balance
tickets {
amount
}
}
}
}