In order to retrieve data from Arweave, you can use the following example query to retrieve the entire transaction output.
query {
transactions {
cursor
edges {
node {
id
anchor
signature
recipient
owner {
address
key
}
fee {
winston
ar
}
quantity {
winston
ar
}
data {
size
type
}
tags {
name
value
}
block {
id
timestamp
height
previous
}
parent {
id
}
}
}
}
}
Here are some example use cases that you might prefer using GraphQL for.
query {
transactions {
edges {
node {
id
}
}
}
}
query {
transactions {
edges {
node {
id
tags {
name
value
}
}
}
}
}
query {
transactions {
edges {
node {
block {
id
timestamp
height
previous
}
}
}
}
}
query {
transactions {
edges {
node {
id
recipient
owner {
address
key
}
fee {
winston
ar
}
quantity {
winston
ar
}
}
}
}
}
There are several arguments you can use to query the Arweave database.
query {
transactions(ids: ["G-1t0Lqysin897HC3IV8xu_Mr884B-Mo5YEnlhUH54k"]) {
edges {
node {
id
}
}
}
}
query {
transactions(recipients:["M6w588ZkR8SVFdPkNXdBy4sqbMN0Y3F8ZJUWm2WCm8M"]) {
edges {
node {
id
}
}
}
}
Single tag filter.
query {
transactions(
tags: {
name: "Content-Type",
values: ["text/html"]
}
) {
edges {
node {
id
}
}
}
}
Multi tag filter.
query {
transactions(
tags: [
{
name: "Content-Type",
values: ["text/html"]
},
{
name: "User-Agent",
values: ["ArweaveAutoDPL/0.1"]
}
]
) {
edges {
node {
id
}
}
}
}
query {
transactions(first: 5) {
edges {
node {
id
}
}
}
}
Or, with a cursor
query {
transactions(first: 5, after: "WyIyMDIwLTA5LTIzVDE2OjQ0OjE0LjY5MloiLDFd") {
edges {
cursor # Make sure to get the edge cursor
node {
id
}
}
}
}
query {
transactions(block: {min: 0, max: 10}) {
edges {
node {
id
}
}
}
}
Descending (Newest first)
query {
transactions(sort: HEIGHT_DESC) {
edges {
cursor
node {
id
}
}
}
}
Ascending (Oldest first)
query {
transactions(sort: HEIGHT_ASC) {
edges {
cursor
node {
id
}
}
}
}
I also mentioned a wrapper library for GraphQL as part of
arweave-js
. Either way, we should be flexible making it accessible and easy to traverse Arweave with both GraphQL and a wrapper library!