Query Irys transactions
Irys transaction metadata can be queried using GraphQL. You can use it to search for transactions by:
- Signer's address
- Payment token
- Metadata tags
- Timestamps
GraphQL clients
You can query using an HTTP library like fetch or axios, or use specialized
clients like Apollo Client or urql.
Endpoint
https://uploader.irys.xyz/graphql
Query arguments
Any of the following query arguments can be used as search parameters:
| Field | Description |
|---|---|
ids | An array of transaction IDs passed as strings. Values are ORed together. Matching results will include transactions that have any of the supplied IDs. |
owner | The address used when posting the transaction. Can be a native address from any of the chains supported by Irys. Note that in results fields, this is referred to as address. |
token | The token used to pay for the transaction. |
tags | An array of tag name/value pairs passed as JSON objects. |
Results fields
When building a query, any of the following values be included in your results:
| Field | Description |
|---|---|
id | The transaction ID. |
address | The address used when posting the transaction. Can be a native address from any of the chains supported by Irys. Note that in query arguments, this is referred to as owner. |
token | The token used to pay for the transaction. |
| An optional receipt, only exists if a user requested one at upload.
deadlineHeight: The block number by which the transaction must be finalized.
signature: A signed deep hash of the JSON receipt. |
| An array of tags supplied as name/value pairs. Exists if the user added them at upload. |
timestamp | The timestamp, accurate to the millisecond of when the transaction was posted. This value is the same as the receipt timestamp. |
Sample Queries
Queries return transaction metadata. To then retrieve data, use the returned
transaction ID and download the data from the Irys gateway using a URL formed
as follows: https://gateway.irys.xyz/:transactionId.
Transaction IDs
Search by transaction IDs.
query getByIds {
transactions(ids: ["--52WQHJIJod_rni8pkl1Vxt9MFGoXZAm8SC7ex6C1o", "--52THRWpX_RJzGcNXmtQ2DSP37d1e1VQ4YmvbY5ZXo"]) {
edges {
node {
id
tags {
name
value
}
}
}
}
}
Timestamps
Search by timestamps:
query getByTimestamp {
transactions(timestamp: { from: 1688144401000, to: 1688317201000 }) {
edges {
node {
id
}
}
}
}
Irys timestamps are accurate to the millisecond, so you need to provide a timestamp in millisecond format when querying. You can convert from human-readable time to UNIX timestamp using websites like Epoch101, be sure to convert in millisecond format, not second.