ERC-3722 · Stagnant · ERC · 2021-07-31
ERC-3722: Poster
A deliberately tiny contract with one function, post(content, tag), that just emits an event, giving decentralized social apps a shared, indexable place to publish posts on any EVM chain.
What problem does it solve?
Building a decentralized social network usually means writing a custom contract with its own storage, IDs and rules, and every app ends up incompatible with the others. Poster takes the opposite approach: the chain only records who said what, and everything else (threads, likes, follows, edits) is reconstructed off-chain by an indexer.
Because the contract is trivial and stateless, it can be deployed once per network at the same address and shared by every app that wants to read or write posts.
How it works
The entire contract is one function and one event:
contract Poster {
event NewPost(address indexed user, string content, string indexed tag);
function post(string calldata content, string calldata tag) public {
emit NewPost(msg.sender, content, tag);
}
}
contentis a free-form string. The spec proposes a JSON format for Twitter-like apps where a singlepost()can carry several items in acontentarray:microblogposts (with optionalreplyTo,image,edit), and operations such asdelete,like,repost,follow,unfollow,block,reportandpermissions.tagis indexed, so an indexer can filter by app or topic. Since it is an indexedstring, the log stores only its keccak256 hash, not the text.- No post ID is emitted. Indexers derive one from
transactionHash+logIndex. - The authors chose
stringoverbytesso posts stay human-readable on block explorers, and chose to emit the content (rather than only calldata) so indexers can rely on logs alone.
The spec's reference deployment uses the EIP-2470 singleton factory so the contract lands at the same address on any EVM network; the address, init code and salt are listed in the spec.
Sample code
A JSON payload that posts a two-message thread, and sending it with ethers v6:
{
"content": [
{ "type": "microblog", "text": "gm, first post in a thread" },
{ "type": "microblog", "text": "second post", "replyTo": "this[0]" }
]
}
import { Contract, Wallet, JsonRpcProvider, id } from "ethers";
const provider = new JsonRpcProvider(process.env.RPC_URL);
const wallet = new Wallet(process.env.PRIVATE_KEY!, provider);
const poster = new Contract(
process.env.POSTER_ADDRESS!, // the deployment on your network
[
"function post(string content, string tag)",
"event NewPost(address indexed user, string content, string indexed tag)",
],
wallet,
);
const payload = JSON.stringify({ content: [{ type: "microblog", text: "hello" }] });
await (await poster.post(payload, "microblog")).wait();
// Read posts with a given tag (topic holds keccak256 of the tag string)
const logs = await poster.queryFilter(poster.filters.NewPost(null, null, id("microblog")));
for (const l of logs) console.log((l as any).args.user, (l as any).args.content);
Things to know
- Status is Stagnant: the proposal is no longer actively progressing toward finalization.
- All meaning lives off-chain. The contract does not validate JSON, enforce deletes or check permissions; the indexer and client must.
- If a post's
"from"differs frommsg.sender, clients should only honor it when"from"previously granted that sender rights via apermissionsitem; otherwise treat it as invalid or as a post bymsg.sender. - Clients must sanitize post content before rendering it.
- Everything posted is public and permanent in the chain's logs; a
deleteonly asks indexers to hide it.