Hey, I am Matthias

Retrieving content from Arweave

Publishing on Mirror and Paragraph means Arweave is coming into the mix.

Great! That means your content is decentralized, permission-less, and, well, yours. You can take it with you, even if Mirror or Paragraph go the way of the dodo.

How do we get our content from Arweave? Let’s dig in.

Arweave provides a GraphQL explorer, and some robust documentation. Combined with Mirror’s notes on how to retrieve content it is easy to get your initial query set up. In the final paragraph there is a note that you can query off the contributor instead of the Content-Digest. I went with that for the time being.

// graphql

query GetWeb3Posts {
  transactions(
    tags: [
      # { name: "App-Name", values: ["MirrorXYZ"] }
      { name: "AppName", values: ["Paragraph"] }
      {
        name: "Contributor"
        values: ["0x429f42fB5247e3a34D88D978b7491d4b2BEe6105"]
      }
    ]
    sort: HEIGHT_DESC
    first: 1
  ) {
    edges {
      node {
        id
      }
    }
  }
}

One thing to note—if you want to get posts from Mirror you use App-Name, for Paragraph you need to use AppName.

This should give you something like this as the response:

// my first post on Paragraph 
{
  "data": {
    "transactions": {
      "edges": [
        {
          "node": {
            "id": "_XgPhhyOdqbtkH1RqPDM9vjqYe1peCJP2jvb_NZDRO4"
          }
        }
      ]
    }
  }
}

That ID can now be used to fetch my first post on Paragraph from Arweave. You can also view the transaction on the block explorer.

If you append the ID to https://arweave.net/ you can view the JSON in your browser. And since it is unauthenticated, the data is yours to do what you want with.

// https://arweave.net/_XgPhhyOdqbtkH1RqPDM9vjqYe1peCJP2jvb_NZDRO4

{
	"updatedAt": 1665184276754,
	"storeOnArweave": true,
	"votes": 0,
	"categories": [],
	"text": "This is my first post on Paragraph ✌️\n\nNot only that, it is the first post in an entirely new content management system for my digital garden. Moving forward, long-form content is going to be published with web3 native platforms like __[Mirror](https://mirror.xyz/)__ and __[Paragraph](https://paragraph.xyz/)__.\n\n*Disclaimer—this post is mirrored on Mirror as part of a content delivery test:*\n\nThe idea is that by leveraging these technologies I can create a more seamless experience that enables patronage while also owning my content in a more robust way.\n\nThe internet is changing and are the ways we interact with it. Diving into web3 is a rabbit hole and I'm excited to share more of my journey with all of you.\n\nThe currently planned stack:\n\n* __[NextJS](https://nextjs.org/)__\n* __[WAGMI](https://wagmi.sh/)__\n* __[Mirror](https://mirror.xyz/)__ or __[Paragraph](https://paragraph.xyz/)__\n  * Paragraph might win out due to their [Farcaster integration](https://paragraph.xyz/@blog/farcaster-comments)\n  * …but Mirror enables collections \n* image host - tbd, but likely __[web3.storage](https://web3.storage/)__\n\nIf you have any thoughts on Next/Image with ipfs / arweave, I’d love to hear them. Feel to reach to me @iammatthias on Farcaster or on bird app.\n\n\\\n",
	"sendNewsletter": false,
	"id": "LlLJ3RFtcDSaIJvTc7jD",
	"archived": false,
	"publishedAt": 1665184276754,
	"accessRestriction": null,
	"slug": "gm",
	"about_me": false,
	"published": true,
	"createdAt": 1665183975717,
	"post_preview": "This is my first post on Paragraph ✌️\n\n",
	"title": "gm"
}

Solid first step. Content can now be published on Mirror and Paragraph and retrieved for future use. On to stage 2: NextJs x Arweave as a CDN.

When a post URL is shared on Farcaster (a sufficiently decentralized social network) the comments are displayed permissionessly below.