Composable Social primitives on Solana are possible using only SPL Library programs and NFT minting program of choice. The NFT minting program used will not affect this method as long as there is a Mint address associated with the NFT.
Account/Profile
The account or profile is a wallet address.
Account account = new Account();
Post
The post is the simplest to understand as its just an NFT as we know it now. A 1/1 of NFT of the media of choice. What differentiates a post from another NFT in the wallet is the Creator account will be the same as the user account, this is how you will filter out all other NFTs from a post
Comments
Comments are txs with 2 instructions: 1 lamport transfer and memo instruction which serves as the comment. The tx is sent to the NFT mint address. Because of the nature of crypto sending and signing txs spoof accounts are impossible.
RpcClient client=getClient();
TransactionInstruction transfer=SystemProgram.transfer(
signer.getPublicKey(),nft,1);
TransactionInstruction comment= createMemoIntruction(message);
Transaction transaction= new Transaction();
transaction.addInstruction(transfer).addInstruction(comment);
transaction.setFeePayer(signer.getPublicKey());
transaction.setRecentBlockHash(client.getApi().getRecentBlockhash());
List<Account>accounts= new ArrayList<>();
accounts.add(signer);
client.getApi().sendTransaction(transaction, accounts);
Direct Messages
DMs are done in a similar manner to comments.
The Memo Transfers could be sent to the Account directly but this would be a pain to sort through and may cause certain RPC latency issues.
To solve this I propose creating 2 separate accounts derived from the sending and receiving accounts public txs. This can be done using the CreateFromSeed function in the SPL library and the MD5 hash of the recipient public key.
//target for message memo tx
PublicKey.createWithSeed(publicKeyMD5ToBase64(recipient.toString()).getBytes(StandardCharsets.UTF_8),user, SystemProgram.PROGRAM_ID);
These two derived accounts can be isolated as the incoming and outgoing messages threads for easier parsing of data.
Secure messaging can be achieved by pairing with ECIES (elliptic curve integrated encryption scheme) on the client side.