Bitcoin Schema

Social Actions

Basic social interactions - likes, follows, and relationships

These schemas are the building blocks for building social networking apps. These on-chain records can be indexed and queried to build full-featured social platforms of all kinds.

Like

Used to express positive sentiment about a post, transaction, or any other global identifier.

OP_RETURN
MAP SET app <appname> type like tx <txid> | AIP BITCOIN_ECDSA <address> <signature>

Unlike

Used to undo a like

OP_RETURN
MAP SET app <appname> type unlike tx <txid> | AIP BITCOIN_ECDSA <address> <signature>

Follow

Used to express a one-way relationship between two identities.

OP_RETURN
MAP SET app <appname> type follow bapID <bapID> | AIP BITCOIN_ECDSA <address> <signature>

Unfollow

Used to express the removal of a relationship between two identities.

OP_RETURN
MAP SET app <appname> type unfollow bapID <pubkey> | AIP BITCOIN_ECDSA <address> <signature>

Friend

Used to express a two-way relationship between two identities and allow for secured communications. Generate the publicKey for future communications based on a SHA256 hash of the other user's bapID. (getSigningPathFromHex is a function from the BAP library).

Generate public key

import { Hash, PrivateKey, Utils } from '@bsv/sdk'

const seedBytes = Hash.sha256(Utils.toArray(friendIdKey, 'utf8'));
const seedHex = Utils.toHex(seedBytes);
const signingPath = getSigningPathFromHex(seedHex);
const hdPrivateFriendKey = PrivateKey.deriveChild(signingPath);

const publicFriendKey = hdPrivateFriendKey.toPublicKey();
OP_RETURN
MAP SET app <appname> type friend bapID <bapID> publicKey <publicFriendKey> | AIP BITCOIN_ECDSA <address> <signature>