Social Platform
The SocialSDK provides a fully on-chain social nanopayments platform on Algorand. Every social interaction is a direct economic transaction in AKTA — posts cost 100 AKTA, upvotes and replies cost 10 AKTA (the majority paid directly to the content creator after an Impact-based protocol fee). Content rises in the feed based on the economic weight of interactions it receives, weighted by the reputation of the users behind them. There is no ad layer or engagement algorithm — only direct value exchange between users.
Initialization
Section titled “Initialization”import { SocialSDK } from '@akta/sdk/social'
const social = new SocialSDK({ algorand })Content Model
Section titled “Content Model”IPFS + On-Chain References
Section titled “IPFS + On-Chain References”Post content (text, images, metadata) is stored on IPFS. The on-chain contract only stores a 36-byte CIDv1 (Content Identifier) pointing to the IPFS content. This keeps on-chain costs low while making content permanently addressable and verifiable.
┌─────────────┐ CIDv1 (36 bytes) ┌─────────────┐│ Algorand │ ◄──────────────────────── │ IPFS ││ (on-chain) │ stored in post box │ (content) │└─────────────┘ └─────────────┘Post Keys
Section titled “Post Keys”Every post is identified by a deterministic 32-byte post key derived from:
postKey = sha256(creatorAddress + timestamp + nonce)- Creator address — the poster’s Algorand address
- Timestamp — must be within 60 seconds of the current block time
- Nonce — a random 24-byte value (auto-generated by the SDK)
The SDK returns the post key after creation, which is used to reference the post for replies, votes, reactions, and edits.
User Meta
Section titled “User Meta”Before using any social features, a user must initialize their on-chain social meta:
const metaIndex = await social.initMeta({})With optional configuration:
const metaIndex = await social.initMeta({ nfd: nfdAssetId, // Link an NFD (Non-Fungible Domain) akitaNFT: nftAssetId, // Link an Akita NFT as profile})Update meta settings later:
await social.updateMeta({ followGateId: gateAppId, // Gate who can follow you addressGateId: gateAppId, // Gate address-level interactions defaultPayWallId: payWallId, // Default x402 paywall for bot access})Creating Posts
Section titled “Creating Posts”Upload your content to IPFS first, then pass the CIDv1 bytes to the SDK:
// 1. Upload content to IPFS (your app handles this)const cid = await uploadToIPFS({ text: 'Hello from Akita!' })
// 2. Create the on-chain postconst { postKey, timestamp, nonce } = await social.post({ cid, // 36-byte IPFS CIDv1 as Uint8Array})The SDK automatically:
- Generates a random 24-byte nonce
- Fetches the current blockchain timestamp
- Pays the post MBR (box storage) in ALGO
- Pays the post fee in AKTA (read from the DAO contract)
Gated Posts
Section titled “Gated Posts”Restrict who can view or interact with a post using a gate:
const { postKey } = await social.post({ cid, gateId: gateAppId, // Only users who pass this gate can interact})Paywalled Posts (x402 / Bot Monetization)
Section titled “Paywalled Posts (x402 / Bot Monetization)”Paywalls let you monetize content for bots and AI agents via the x402 payment protocol. When a bot encounters an x402-paywalled post, it pays on-chain to unlock access — enabling machine-to-machine content monetization without human intervention.
You can configure separate payment terms for human users vs. agent/bot access:
// Create a paywall with bot-specific pricingconst payWallId = await social.createPayWall({ userPayInfo: [ // Human users: one-time ALGO payment { type: PayWallType.OneTimePayment, assetOrSubId: 0n, amount: 1_000_000n }, ], agentPayInfo: [ // Bots/agents: per-access AKTA payment via x402 { type: PayWallType.OneTimePayment, assetOrSubId: aktaAssetId, amount: 500_000n }, ],})
// Attach it to a postconst { postKey } = await social.post({ cid, usePayWall: true, payWallId,})The agentPayInfo array defines the x402 payment terms that bots must satisfy. When an agent wallet encounters a paywalled post, it can automatically pay via its escrow within configured spending allowances.
Editing Posts
Section titled “Editing Posts”Edits create an amendment linked to the original post. The edit key is deterministic — editing with the same new CID always produces the same key.
const editKey = await social.editPost({ cid: newCid, // Updated IPFS CIDv1 amendment: postKey, // Original post's 32-byte key})Replying
Section titled “Replying”Replies reference another post (or asset, address, app, or external content):
import { RefType } from '@akta/sdk/social'
const { replyKey } = await social.reply({ cid, // Reply content on IPFS ref: parentPostKey, // 32-byte reference of the parent refType: RefType.Post,})Reference Types
Section titled “Reference Types”Replies can target different on-chain entities:
| RefType | Value | Description |
|---|---|---|
Post | 10 | Reply to another post |
Asset | 20 | Comment on an ASA |
Address | 30 | Comment on an address |
App | 40 | Comment on an application |
External | 50 | Reference external content (e.g., Twitter) |
Gated Replies
Section titled “Gated Replies”const { replyKey } = await social.reply({ cid, ref: parentPostKey, refType: RefType.Post, gateTxn: gateCallTxn, // Gate proof transaction})Voting
Section titled “Voting”Upvote or downvote any post. Votes contribute to the author’s impact score.
// Upvoteawait social.vote({ ref: postKey, refType: RefType.Post, isUp: true,})
// Downvoteawait social.vote({ ref: postKey, refType: RefType.Post, isUp: false,})Flip an existing vote:
await social.invertVote({ ref: postKey })Remove a vote entirely (refunds the MBR):
await social.deleteVote({ ref: postKey })Reacting with NFTs
Section titled “Reacting with NFTs”Users react to posts using NFTs they hold. Each NFT-reaction pair is tracked, and reaction counts are stored on-chain.
await social.react({ ref: postKey, refType: RefType.Post, nft: reactionNftId, // ASA ID of the NFT used as a reaction})Remove a reaction:
await social.deleteReaction({ ref: postKey, nft: reactionNftId })Reading Reactions
Section titled “Reading Reactions”const { reactions, userReactedNfts } = await social.getPostReactions({ ref: postKey, userAddress: myAddress, // Optional — check which NFTs this user reacted with})
// reactions: [{ nftId: 123n, count: 5n }, { nftId: 456n, count: 12n }]// userReactedNfts: Set<bigint> of NFT IDs the user has usedReading Posts
Section titled “Reading Posts”// Get a single postconst post = await social.getPost({ ref: postKey })
// Get a post with its creator's metaconst { post, meta } = await social.getPostAndCreatorMeta({ ref: postKey })
// Check a user's vote on a postconst vote = await social.getVote({ account: userAddress, ref: postKey })
// Batch read votesconst votes = await social.getVotes({ keys: [ { account: userAddress, ref: postKey1 }, { account: userAddress, ref: postKey2 }, ],})Every write operation pays two costs:
| Cost | Currency | Purpose |
|---|---|---|
| MBR | ALGO | Minimum Balance Requirement for on-chain box storage |
| Fee | AKTA | Protocol fee — majority goes to the content creator, remainder to DAO treasury |
| Operation | AKTA Cost | Creator Receives |
|---|---|---|
| Post | 100 AKTA | — |
| Upvote / Reply | 10 AKTA | Majority (after Impact-based protocol fee) |
Higher-Impact users pay lower protocol fees (1–20% of the interaction cost, based on Impact score), meaning more of the payment reaches the creator. The SDK reads fees from the DAO contract automatically. You can pre-calculate MBR costs:
const postMbr = social.calculatePostMBR()const replyMbr = social.calculateReplyMBR()const reactMbr = social.calculateReactMBR()const followMbr = social.calculateFollowMBR()Related Contracts
Section titled “Related Contracts”The social system spans four contracts, all accessed through SocialSDK:
| Contract | Purpose |
|---|---|
| Akita Social | Posts, reactions, votes, x402 paywalls, meta |
| Social Graph | Follow/unfollow, block/unblock |
| Social Impact | Impact scoring from social activity |
| Social Moderation | Moderator roles, bans, content flagging |
See also: Social Graph, Social Impact, Moderation
Social operations through a wallet use the SocialPlugin. See Wallet Plugins.