Skip to content

Messages

A message is the fundamental data type in the Farcaster network.

When an account takes an action like casting a public message, change its profile or verifying an Ethereum account, it generates a new messages

1. Message

The message is a protobuf that contains the data, its hash and a signature from the author.

FieldTypeLabelDescription
dataMessageDataContents of the message. Alternatively, you can use the data_bytes to serialize the MessageData
hashbytesHash digest of data
hash_schemeHashSchemeHash scheme that produced the hash digest
signaturebytesSignature of the hash digest
signature_schemeSignatureSchemeSignature scheme that produced the signature
signerbytesPublic key or address of the key pair that produced the signature
data_bytesbytesAlternate to the "data" field. If you are constructing the MessageData in a programing language other than Typescript, you can use this field to serialize the MessageData and calculate the hash and signature on these bytes. Optional.

1.1 MessageData

MessageData is a generic envelope that contains a type, fid, timestamp and network which must be present in all Farcaster messages. It also contains a body whose type is determined by the MessageType.

FieldTypeLabelDescription
typeMessageTypeType of Message contained in the body
fiduint64Farcaster ID of the user producing the message
timestampuint32Farcaster epoch timestamp in seconds
networkFarcasterNetworkFarcaster network the message is intended for
bodyCastAddBody,
CastRemoveBody,
ReactionBody,
VerificationAddEthAddressBody,
VerificationRemoveBody,
UserDataBody,
LinkBody,
UserNameProof
oneOfProperties specific to the MessageType

1.2 HashScheme

Type of hashing scheme used to produce a digest of MessageData

NameNumberDescription
HASH_SCHEME_NONE0
HASH_SCHEME_BLAKE31Default scheme for hashing MessageData

1.3 Signature Scheme

Type of signature scheme used to sign the Message hash

NameNumberDescription
SIGNATURE_SCHEME_NONE0
SIGNATURE_SCHEME_ED255191Ed25519 signature (default)
SIGNATURE_SCHEME_EIP7122ECDSA signature using EIP-712 scheme

1.4 Message Type

Type of the MessageBody

NameNumberDescription
MESSAGE_TYPE_NONE0Invalid default value
MESSAGE_TYPE_CAST_ADD1Add a new Cast
MESSAGE_TYPE_CAST_REMOVE2Remove an existing Cast
MESSAGE_TYPE_REACTION_ADD3Add a Reaction to a Cast
MESSAGE_TYPE_REACTION_REMOVE4Remove a Reaction from a Cast
MESSAGE_TYPE_LINK_ADD5Add a Link to a target
MESSAGE_TYPE_LINK_REMOVE6Remove a Link from a target
MESSAGE_TYPE_VERIFICATION_ADD_ETH_ADDRESS7Add a Verification of an Ethereum Address
MESSAGE_TYPE_VERIFICATION_REMOVE8Remove a Verification
MESSAGE_TYPE_USER_DATA_ADD11Add metadata about a user
MESSAGE_TYPE_USERNAME_PROOF12Add or replace a username proof

1.5 Farcaster Network

Farcaster network the message is intended for

NameNumberDescription
FARCASTER_NETWORK_NONE0
FARCASTER_NETWORK_MAINNET1Public primary network
FARCASTER_NETWORK_TESTNET2Public test network
FARCASTER_NETWORK_DEVNET3Private test network

2. UserData

A UserData message represents user metadata (e.g. a profile picture url) .

2.1 UserDataBody

Body of a UserData message

FieldTypeLabelDescription
typeUserDataTypeType of metadata
valuestringValue of the metadata

2.2 UserDataType

Type of UserData message

NameNumberDescription
USER_DATA_TYPE_NONE0Invalid default value
USER_DATA_TYPE_PFP1Profile Picture for the user
USER_DATA_TYPE_DISPLAY2Display Name for the user
USER_DATA_TYPE_BIO3Bio for the user
USER_DATA_TYPE_URL5URL of the user
USER_DATA_TYPE_USERNAME6Preferred Farcaster Name for the user

3. Cast

A Cast message is a public post from a user.

3.1 CastAddBody

Adds a new Cast message.

FieldTypeLabelDescription
embeds_deprecatedstringrepeatedURLs to be embedded in the cast
mentionsuint64repeatedFids mentioned in the cast
parent_cast_idCastIdParent cast of the cast
parent_urlstringParent URL of the cast
textstringText of the cast
mentions_positionsuint32repeatedPositions of the mentions in the text
embedsEmbedrepeatedURLs or cast ids to be embedded in the cast

Embed

FieldTypeLabelDescription
urlstring
cast_idCastId

3.2 CastRemoveBody

Removes an existing Cast message.

FieldTypeLabelDescription
target_hashbytesHash of the cast to remove

3.3 CastId

Identifier used to look up a Cast

FieldTypeLabelDescription
fiduint64Fid of the user who created the cast
hashbytesHash of the cast

4. Reaction

A Reaction message creates a relationship between an account and a cast. (e.g. like)

4.1 ReactionBody

Adds or removes a Reaction from a Cast

FieldTypeLabelDescription
typeReactionTypeType of reaction
target_cast_idCastIdCastId of the Cast to react to
target_urlstringURL to react to

4.2 ReactionType

Type of Reaction

NameNumberDescription
REACTION_TYPE_NONE0Invalid default value
REACTION_TYPE_LIKE1Like the target cast
REACTION_TYPE_RECAST2Share target cast to the user's audience

A Link message creates a relationship between two users (e..g follow)

5.1 LinkBody

Adds or removes a Link

FieldTypeLabelDescription
typestringType of link, <= 8 characters
displayTimestampuint32optionalUser-defined timestamp that preserves original timestamp when message.data.timestamp needs to be updated for compaction
target_fiduint64The fid the link relates to

6. Verification

A Verification message is a proof of ownership of something.

6.1 VerificationAddEthAddressBody

Adds a bi-directional signature proving that an fid has control over an Ethereum address.

FieldTypeLabelDescription
addressbytesEthereum address being verified
eth_signaturebytesSignature produced by the user's Ethereum address
block_hashbytesHash of the latest Ethereum block when the claim was produced

6.2 VerificationRemoveBody

Removes a Verification of any type

FieldTypeLabelDescription
addressbytesAddress of the Verification to remove

7. Frame Action

Represents an action performed by a user on a frame. This message is not stored on the hubs and cannot be submitted, only validated.

7.1 FrameActionBody

A user action on a frame

FieldTypeLabelDescription
urlbytesThe original url of the frame as embedded in the cast
button_indexuint32The button that was pressed (indexed from 1)
cast_idCastIdThe cast id that hosted the frame
input_textbytesAny text the user input as part of the action
statebytesSerialized state passed from frame to server