DEV Community

Cover image for Social Protocols on Arweave
K for Fullstack Frontend

Posted on

Social Protocols on Arweave

Social media is one of the main drivers for web adoption. While it gave ordinary people a way of publishing their content to a worldwide audience, all could be better regarding the providers of social media services. Huge private entities like Meta or X make the rules and decide what’s appropriate for their platforms, and the algorithms that govern what people see are considered trade secrets.

Decentralized social media promises to solve these issues by letting users own their identity and content. However, their underlying blockchain networks often come with exorbitant storage costs, and computations aren’t free either. Arweave lowered the pricing tags for decentralized storage and computation by several magnitudes, bringing the costs of social media solutions built on public standards to a reasonable level while achieving scalability.

This article will explain data protocols on Arweave and how creators use them to build decentralized social media platforms.

What are Social Protocols?

Social protocols are public specifications of social media interactions. They allow interoperability between social media systems created by different organizations. This way, the users can choose which organization they want to trust with their data and change this opinion if someone starts a better implementation or if their chosen organization becomes hostile.

Common social media interactions include likes, comments, re-sharing of the content, and becoming a follower of one another. In the context of traditional social media platforms, these interactions are closed source. Private companies own the infrastructure that handles these interactions; they are the gatekeepers of their social networks and don’t publish how their protocols work, making getting user data out of their systems hard.

Why is Arweave Suitable for Social Protocols?

Arweave is a good choice for social protocols because it is publicly accessible to everyone, making interoperability between different apps that use the protocol data easy. Arweave’s storage and computation costs are magnitudes lower than in other popular networks like Ethereum. As data on Arweave is permanent, traversals of social interactions well into the future enable open social graphs to connect coming generations with previous ones.

With its layer 2 bundling solutions, it can scale to handle millions of TPS; a must when building social media services for the masses. Lastly, tagging your transactions (TXs) and querying them via GraphQL allows you to compose the data as your DApp needs.

How Would Social Protocols on Arweave Work?

Arweave, as a blockchain network, is oblivious to the applications running on it. There are multiple ways to design a social protocol for Arweave, but a common one is defining it as a data protocol. The data protocol specification defines a useful approach when building protocols on Arweave, so it’s a good starting point for a social protocol. As with many Arweave specifications, it defines which tags and data formats a TX should use to be interoperable.

How do Transactions on Arweave Work?

To understand the ideas behind Arweaves data protocols, let’s step back and check out TXs.

Arweave TXs are a form of semi-structured data. They consist of the TX data and the TX body. The body is unconstrained in format and size. The data contains common information about the TX creator, creation time, and custom key-value pairs called tags. This split allows Arweave to store huge files, mark them with the creator, the upload time, and custom information that relates the files to other files or makes them discoverable on the network. You can query the TX data with GraphQL to filter for each of its fields, but you can only load the whole TX body with its TX ID, like in a key-value store.

For example, you could submit a TX with an image as TX data and a "Twitter-Account" tag with your Twitter handle. Everyone who knows your Twitter handle could find that image on Arweave, while Twitter cannot delete it. But they would need to query the TX data first to get all TX tagged with the right account and then use the found TX IDs to load the images in their TX bodies.

Figure 1 illustrates the TX format currently used by Arweave.

Figure 1: Arweave TX Format V2

How do Data Protocols on Arweave Work?

The first part of Arweave’s data protocol specification is essentially a specification of specifications. It’s also recursive, so it defines requirements for data protocols while conforming to those requirements.

For example, it defines a data protocol specification as a TX with a "Data-Protocol" tag containing the value "Specification", and it also is a TX with this tag, making it part of its own data protocol. If you query all TXs with this tag, you also get the TX that defined this tag in the first place.

The second part defines the minimal tags required for a TX to conform to a data protocol, allowing users to relate all its TXs to each other. The "Data-Protocol" tag of these TXs would have the name of your data protocol as a value but not "Specification".

So, to define a data protocol on Arweave, you submit one TX that contains the specification as TX data written in Markdown and the following tags:

  • "Content-Type": "text/markdown"
  • "Data-Protocol": "Specification"
  • "Name": "<YOUR_PROTOCOL_NAME>"

Then, you submit the actual TXs that use your protocol with at least the following tags:

  • "Content-Type": "<YOUR_PROTOCOL_CONTENT_TYPE>"
  • "Data-Protocol": "<YOUR_PROTOCOL_NAME>"

This lets you query all your protocol’s TXs via your custom "Data-Protocol" tag.

Note: There are protocols on Arweave that pre-date the Data-Protocol specification, and nobody is bound to use it. So, in practice, you will encounter protocols with different tags. But following this spec is a good idea when you build your own protocol.

What are Popular Social Protocols on Arweave?

Now that we covered the background let’s look at how people specified and implemented social protocols on top of the data protocol specification.

STAMP

The Signature Timestamp And Metadata Protocol, or short STAMP, is the “Like-Button” of the Permaweb. It allows you to show your appreciation for any TX on Arweave. And it's simple, too.

For historical reasons, STAMP isn’t data-protocol conform, but it only requires two tags:

  • Required Tags
    • Protocol-Name makes the TX part of the protocol.
    • Data-Source contains the ID of the TX you want to stamp/like.

Let’s look at an example of how to stamp with the Irys SDK:

await irys.upload("STAMP", {
  tags: [
    { name: "Protocol-Name", value: "Stamp" },
    { name: "Data-Source", value: "<TARGET_TX_ID>" }
  ],
})
Enter fullscreen mode Exit fullscreen mode

If you have a TX and want to check how many people stamped it, you can now query for these two tags and get all “likes”.

STAMP also has a JavaScript library that helps integrate it into your app.

Permaweb Comments

The Permaweb Comments specification defines a data protocol that lets people comment on any TX on Arweave.

The spec requires storing the comment text in the TX data and that at least three tags are present:

  • Required Tags
    • Content-Type ensures that all comments are just plain text.
    • Data-Protocol makes the TX part of the Permaweb Comments protocol.
    • Data-Source is the TX ID of the TX that you want to comment on.
  • Optional Tags
    • Root-Source is optional, but you can use it when commenting on comments and want to group them by the TX ID of the first comment in that thread/tree.

Let’s look at an example of how to post a Permaweb comment:

await irys.upload("<COMMENT_TEXT>", {
  tags: [
    { name: "Content-Type", value: "text/plain" },
    { name: "Data-Protocol", value: "comment" },
    { name: "Data-Source", value: "<PARENT_TX_ID>" },
    { name: "Root-Source", value: "<ROOT_TX_ID>" }
  ],
})
Enter fullscreen mode Exit fullscreen mode

Just add your text, mark it as a comment, and link it to the thing you want to comment on.

Vouch-For

The Vouch-For protocol is a bit more nuanced. Its goal is to let users vouch for other users. If you know the wallet address of someone you trust, you can check if they testified for other wallet addresses. This way, you don’t have to check if someone is trustworthy.

An example use-case could be comment filtering. Since Permaweb Comments are TXs, they all have an owner field containing the comment creator's address. You can check if there is a Vouch-For TX for the comment owner and ignore it if it's missing.

The specification defines five tags:

  • Required Tags
    • App-Name marks the TX as part of the protocol.
    • Vouch-For contains the Arweave address you want to vouch for.
  • Optional Tags
    • App-Version is optional and used to allow changes in the protocol.
    • Verification-Method is also optional. It defines the method you use to check that someone is trustworthy.
    • User-Identifier is optional, too. You can add the account name or ID if you didn’t verify the address In-Person.

To vouch for an address, you have to submit a TX with just two tags:

await irys.upload("", {
  tags: [
    { name: "App-Name", value: "Vouch" },
    { name: "Vouch-For", value: "<ARWEAVE_ADDRESS>" }
  ],
})
Enter fullscreen mode Exit fullscreen mode

Anyone who trusts your address can now query for your vouch TXs and use it to filter TX in their app.

How does Lens Protocol Leverage Arweave?

Lens Protocol is a social protocol built on the Polygon blockchain network. When Lens faced performance and cost issues because of its high load, it needed a data availability solution that gave them reasonable security guarantees while processing TX faster than Polygon. They looked at layer 2 networks, which promise better performance and lower costs, but the state-of-the-art solutions weren’t sufficient. So, they went a different route and built their own solution with Arweave and Irys.

Irys is a layer 2 solution on top of Arweave that can handle millions of TX per second. Arweave provides onchain (i.e., permanent and immutable) storage magnitudes cheaper than Polygon or EVM layer 2 networks.

The solution is called Momoka, which could be called a layer 3 data availability service. It simulates TXs on Polygon but then submits them with metadata (e.g., blockheight, etc.) to Irys, which finalizes them on Arweave. Since the data is publicly available, everyone can check that these TXs are correct.

You can check Momoka TXs yourself with the Momoka Explorer. There, you can also see that the costs for a TX are $0.0005.

Summary

Social media is one of the most crucial parts of the traditional web, so it’s no surprise that the Permaweb has social solutions of its own. The difference is that Permaweb social media is built on public protocols right from the start to ensure Permaweb apps don’t have to resort to in-house solutions. This gives the Permaweb the potential to be a more open alternative to the traditional social media providers that tend to censor and gatekeep their platforms.

Finally, there's the benefit of data storage designed to stick around for 200+ years, allowing inter-generational social connections we haven't experienced online yet. Connecting with your great-great-grandparents by seeing what music they listened to and liked, what their friends were talking about publicly, and what topics were top of mind. All this could be possible with Arweave.

Top comments (0)