Transactions
A query dedicated to returning user commands, otherwise known as transactions (excludes coinbase and fee transfers). This data is the same as that obtained via the block
query but separated out into its own query for ease of use.
Get the last 25 transactions for a public key
Get all transactions to, or from, a public key. Only includes those on the canonical chain.
{
transactions(limit: 25, sortBy: DATETIME_DESC, query: {
canonical: true,
OR: [{
to: "B62qpge4uMq4Vv5Rvc8Gw9qSquUYd6xoW1pz7HQkMSHm6h1o7pvLPAN"
}, {
from: "B62qpge4uMq4Vv5Rvc8Gw9qSquUYd6xoW1pz7HQkMSHm6h1o7pvLPAN"
}]
}) {
fee
from
to
nonce
amount
memo
hash
kind
dateTime
block {
blockHeight
stateHash
}
failureReason
}
}
Return associated block data for a transaction
The block
relationship may be used to extract information about the block the transaction was contained in.
{
transactions(
limit: 1
sortBy: DATETIME_DESC
query: {from: "B62qqHM1bihHNvju89PFYugLw73PYRb7pGwp82CpEmWfSYVJiQAppaC"}
) {
from
to
nonce
amount
hash
block {
protocolState {
consensusState {
blockHeight
}
}
}
failureReason
}
}
Get all transactions sent from a public key after a date
{
transactions(
limit: 10
sortBy: NONCE_DESC
query: {
from: "B62qqHM1bihHNvju89PFYugLw73PYRb7pGwp82CpEmWfSYVJiQAppaC"
dateTime_gte: "2021-01-26T00:00:00Z"
}
) {
from
to
nonce
dateTime
amount
hash
failureReason
}
}
Find the largest fees sent in a period
This query demonstrates additional sorting options by sorting the transactions by largest fee.
{
transactions(
limit: 10
sortBy: FEE_DESC
query: { AND: [{dateTime_gte: "2021-01-26T00:00:00Z"}, {dateTime_lte: "2021-01-27T00:00:00Z"}] }
) {
from
to
fee
nonce
dateTime
amount
hash
failureReason
}
}
Determine the largest transfers made in a period
This query finds the largest transfers made over a period.
{
transactions(
limit: 10
sortBy: AMOUNT_DESC
query: { AND: [{dateTime_gte: "2021-01-26T00:00:00Z"}, {dateTime_lte: "2021-01-27T00:00:00Z"}] }
) {
from
to
fee
nonce
dateTime
amount
hash
failureReason
}
}
Find where the memo field is not empty
Memos are returned in base58 check encoding. The default memo is E4YM2vTHhWEg66xpj52JErHUBU4pZ1yageL4TVDDpTTSsv8mK6YaH
so this query simply returns all results who memo is no that value so they can be decoded.
{
transactions(
limit: 10
sortBy: AMOUNT_DESC
query: {
AND: [
{ dateTime_gte: "2021-01-26T00:00:00Z" }
{ dateTime_lte: "2021-01-27T00:00:00Z" }
{ memo_ne: "E4YM2vTHhWEg66xpj52JErHUBU4pZ1yageL4TVDDpTTSsv8mK6YaH" }
]
}
) {
from
to
fee
nonce
dateTime
amount
hash
memo
failureReason
}
}
Using the dateTime query filters you can greatly improve the performance of your queries by more specifically targeting your date range of returned results.