Skip to content

Schema

The following tables are created in Postgres DB where data from the Hubs are stored:

chain_events

All onchain events received from the hub event stream are stored in this table. These events represent any onchain action including registrations, transfers, signer additions/removals, storage rents, etc. Events are never deleted (i.e. this table is append-only).

Column NameData TypeDescription
iduuidGeneric identifier specific to this DB (a.k.a. surrogate key)
created_attimestamp with time zoneWhen the row was first created in this DB (not the same as the message timestamp!)
block_timestamptimestamp with time zoneTimestamp of the block this event was emitted in UTC.
fidbigintFID of the user that signed the message.
chain_idbigintChain ID.
block_numberbigintBlock number of the block this event was emitted.
transaction_indexsmallintIndex of the transaction in the block.
log_indexsmallintIndex of the log event in the block.
typesmallintType of chain event.
block_hashbyteaHash of the block where this event was emitted.
transaction_hashbyteaHash of the transaction triggering this event.
bodyjsonJSON representation of the chain event body (changes shape based on type).
rawbyteaRaw bytes representing the serialized OnChainEvent protobuf.

fids

Stores all registered FIDs on the Farcaster network.

Column NameData TypeDescription
fidbigintFID of the user (primary key)
created_attimestamp with time zoneWhen the row was first created in this DB (not the same as registration date!)
updated_attimestamp with time zoneWhen the row was last updated.
registered_attimestamp with time zoneTimestamp of the block in which the user was registered.
chain_event_iduuidID of the row in the chain_events table corresponding to this FID's initial registration.
custody_addressbyteaAddress that owns the FID.
recovery_addressbyteaAddress that can initiate a recovery for this FID.

signers

Stores all registered account keys (signers).

Column NameData TypeDescription
iduuidGeneric identifier specific to this DB (a.k.a. surrogate key)
created_attimestamp with time zoneWhen the row was first created in this DB (not the same as when the key was created on the network!)
updated_attimestamp with time zoneWhen the row was last updated.
added_attimestamp with time zoneTimestamp of the block where this signer was added.
removed_attimestamp with time zoneTimestamp of the block where this signer was removed.
fidbigintFID of the user that authorized this signer.
requester_fidbigintFID of the user/app that requested this signer.
add_chain_event_iduuidID of the row in the chain_events table corresponding to the addition of this signer.
remove_chain_event_iduuidID of the row in the chain_events table corresponding to the removal of this signer.
key_typesmallintType of key.
metadata_typesmallintType of metadata.
keybyteaPublic key bytes.
metadatabyteaMetadata bytes as stored on the blockchain.

username_proofs

Stores all username proofs that have been seen. This includes proofs that are no longer valid, which are soft-deleted via the deleted_at column. When querying usernames, you probably want to query the fnames table directly, rather than this table.

Column NameData TypeDescription
iduuidGeneric identifier specific to this DB (a.k.a. surrogate key)
created_attimestamp with time zoneWhen the row was first created in this DB (not the same as when the key was created on the network!)
updated_attimestamp with time zoneWhen the row was last updated.
timestamptimestamp with time zoneTimestamp of the proof message.
deleted_attimestamp with time zoneWhen this proof was revoked or otherwise invalidated.
fidbigintFID that the username in the proof belongs to.
typesmallintType of proof (either fname or ENS).
usernametextUsername, e.g. dwr if an fname, or dwr.eth if an ENS name.
signaturebyteaProof signature.
ownerbyteaAddress of the wallet that owns the ENS name, or the wallet that provided the proof signature.

fnames

Stores all usernames that are currently registered. Note that in the case a username is deregistered, the row is soft-deleted via the deleted_at column until a new username is registered for the given FID.

Column NameData TypeDescription
iduuidGeneric identifier specific to this DB (a.k.a. surrogate key)
created_attimestamp with time zoneWhen the row was first created in this DB (not the same as when the key was created on the network!)
updated_attimestamp with time zoneWhen the row was last updated.
registered_attimestamp with time zoneTimestamp of the username proof message.
deleted_attimestamp with time zoneWhen the proof was revoked or the fname was otherwise deregistered from this user.
fidbigintFID the username belongs to.
typesmallintType of username (either fname or ENS).
usernametextUsername, e.g. dwr if an fname, or dwr.eth if an ENS name.

messages

All Farcaster messages retrieved from the hub are stored in this table. Messages are never deleted, only soft-deleted ( i.e. marked as deleted but not actually removed from the DB).

Column NameData TypeDescription
iduuidGeneric identifier specific to this DB (a.k.a. surrogate key)
created_attimestamp with time zoneWhen the row was first created in this DB (not the same as the message timestamp!)
updated_attimestamp with time zoneWhen the row was last updated.
timestamptimestamp with time zoneMessage timestamp in UTC.
deleted_attimestamp with time zoneWhen the message was deleted by the hub (e.g. in response to a CastRemove message, etc.)
pruned_attimestamp with time zoneWhen the message was pruned by the hub.
revoked_attimestamp with time zoneWhen the message was revoked by the hub due to revocation of the signer that signed the message.
fidbigintFID of the user that signed the message.
typesmallintMessage type.
hash_schemesmallintMessage hash scheme.
signature_schemesmallintMessage hash scheme.
hashbyteaMessage hash.
signaturebyteaMessage signature.
signerbyteaSigner used to sign this message.
bodyjsonJSON representation of the body of the message.
rawbyteaRaw bytes representing the serialized message protobuf.

casts

Represents a cast authored by a user.

Column NameData TypeDescription
iduuidGeneric identifier specific to this DB (a.k.a. surrogate key)
created_attimestamp with time zoneWhen the row was first created in this DB (not the same as the message timestamp!)
updated_attimestamp with time zoneWhen the row was last updated.
timestamptimestamp with time zoneMessage timestamp in UTC.
deleted_attimestamp with time zoneWhen the cast was considered deleted/revoked/pruned by the hub (e.g. in response to a CastRemove message, etc.)
fidbigintFID of the user that signed the message.
parent_fidbigintIf this cast was a reply, the FID of the author of the parent cast. null otherwise.
hashbyteaMessage hash.
root_parent_hashbyteaIf this cast was a reply, the hash of the original cast in the reply chain. null otherwise.
parent_hashbyteaIf this cast was a reply, the hash of the parent cast. null otherwise.
root_parent_urltextIf this cast was a reply, then the URL that the original cast in the reply chain was replying to.
parent_urltextIf this cast was a reply to a URL (e.g. an NFT, a web URL, etc.), the URL. null otherwise.
texttextThe raw text of the cast with mentions removed.
embedsjsonArray of URLs or cast IDs that were embedded with this cast.
mentionsjsonArray of FIDs mentioned in the cast.
mentions_positionsjsonUTF8 byte offsets of the mentioned FIDs in the cast.

reactions

Represents a user reacting (liking or recasting) content.

Column NameData TypeDescription
iduuidGeneric identifier specific to this DB (a.k.a. surrogate key)
created_attimestamp with time zoneWhen the row was first created in this DB (not the same as the message timestamp!)
updated_attimestamp with time zoneWhen the row was last updated.
timestamptimestamp with time zoneMessage timestamp in UTC.
deleted_attimestamp with time zoneWhen the reaction was considered deleted by the hub (e.g. in response to a ReactionRemove message, etc.)
fidbigintFID of the user that signed the message.
target_cast_fidbigintIf target was a cast, the FID of the author of the cast. null otherwise.
typesmallintType of reaction.
hashbyteaMessage hash.
target_cast_hashbyteaIf target was a cast, the hash of the cast. null otherwise.
target_urltextIf target was a URL (e.g. NFT, a web URL, etc.), the URL. null otherwise.

Represents a link between two FIDs (e.g. a follow, subscription, etc.)

Column NameData TypeDescription
iduuidGeneric identifier specific to this DB (a.k.a. surrogate key)
created_attimestamp with time zoneWhen the row was first created in this DB (not when the link itself was created on the network!)
updated_attimestamp with time zoneWhen the row was last updated
timestamptimestamp with time zoneMessage timestamp in UTC.
deleted_attimestamp with time zoneWhen the link was considered deleted by the hub (e.g. in response to a LinkRemoveMessage message, etc.)
fidbigintFarcaster ID (the user ID).
target_fidbigintFarcaster ID of the target user.
display_timestamptimestamp with time zoneWhen the row was last updated.
typestringType of connection between users, e.g. follow.
hashbyteaMessage hash.

verifications

Represents a user verifying something on the network. Currently, the only verification is proving ownership of an Ethereum wallet address.

Column NameData TypeDescription
iduuidGeneric identifier specific to this DB (a.k.a. surrogate key)
created_attimestamp with time zoneWhen the row was first created in this DB (not the same as the message timestamp!)
updated_attimestamp with time zoneWhen the row was last updated.
timestamptimestamp with time zoneMessage timestamp in UTC.
deleted_attimestamp with time zoneWhen the verification was considered deleted by the hub (e.g. in response to a VerificationRemove message, etc.)
fidbigintFID of the user that signed the message.
hashbyteaMessage hash.
signer_addressbyteaAddress of the wallet being verified.
block_hashbyteaBlock hash of the latest block at the time the ownership was verified.
signaturebyteaOwnership proof signature.

user_data

Represents data associated with a user (e.g. profile photo, bio, username, etc.)

Column NameData TypeDescription
iduuidGeneric identifier specific to this DB (a.k.a. surrogate key)
created_attimestamp with time zoneWhen the row was first created in this DB (not the same as the message timestamp!)
updated_attimestamp with time zoneWhen the row was last updated.
timestamptimestamp with time zoneMessage timestamp in UTC.
deleted_attimestamp with time zoneWhen the data was considered deleted by the hub
fidbigintFID of the user that signed the message.
typesmallintThe type of user data (PFP, bio, username, etc.)
hashbyteaMessage hash.
valuetextThe string value of the field.

storage_allocations

Stores how many units of storage each FID has purchased, and when it expires.

Column NameData TypeDescription
iduuidGeneric identifier specific to this DB (a.k.a. surrogate key)
created_attimestamp with time zoneWhen the row was first created in this DB
updated_attimestamp with time zoneWhen the row was last updated.
rented_attimestamp with time zoneMessage timestamp in UTC.
expires_attimestamp with time zoneWhen this storage allocation will expire.
chain_event_iduuidID of the row in the chain_events table representing the onchain event where storage was allocated.
fidbigintFID that owns the storage.
unitssmallintNumber of storage units allocated.
payerbyteaWallet address that paid for the storage.