Protocol Documentation

February 19, 2024 · View on GitHub

Table of Contents

Top

proto/App.proto

AppAction

FieldTypeLabelDescription
app_idstringrequiredID of application
metadatabytesoptionalMetadata
raw_actionbytesoptionalRaw metadata of wrapped action
signaturebytesoptionalSignature over app commitment

AppActionMetadata

FieldTypeLabelDescription
video_idstringoptionalYouTube video ID

AppAction.ActionType

NameNumberDescription
CREATE_VIDEO0
CREATE_CHANNEL1

AppAction.CreatorType

NameNumberDescription
CHANNEL0
MEMBER1
CURATOR_GROUP2

Top

proto/Bounty.proto

BountyMetadata

FieldTypeLabelDescription
titlestringoptionalBounty title
descriptionstringoptionalBounty description
discussionThreaduint64optionalId of the forum thread used to discuss the bounty
banner_image_uristringoptionalImage uri of the bounty's banner

BountyWorkData

FieldTypeLabelDescription
titlestringoptionalTitle of the work
descriptionstringoptionalDescription which contains the work itself as a URL, a BLOB, or just text

Top

proto/Channel.proto

ChannelMetadata

FieldTypeLabelDescription
titlestringoptionalChannel Title
descriptionstringoptionalChannel Description
is_publicbooloptionalWether to display channel to the public
languagestringoptionalISO_639-1 Language Code
cover_photouint32optionalindex into external assets array
avatar_photouint32optionalindex into external assets array

Top

proto/ChannelPayouts.proto

ChannelPayoutsMetadata

FieldTypeLabelDescription
headerChannelPayoutsMetadata.HeaderrequiredPayload header
bodyChannelPayoutsMetadata.BodyrequiredPayload body

ChannelPayoutsMetadata.Body

Channel payout full body structure, it will not be downloaded by clients in full

FieldTypeLabelDescription
channel_payoutsChannelPayoutsMetadata.Body.ChannelPayoutProofrepeatedList of channel payouts

ChannelPayoutsMetadata.Body.ChannelPayoutProof

FieldTypeLabelDescription
channel_iduint32required
cumulative_reward_earnedstringrequiredSince protobuf does not support 128 bit unsigned inetgers so string representation is being used here, after message decoding the string would be converted to BN to pervent precision loss
merkle_branchChannelPayoutsMetadata.Body.ChannelPayoutProof.ProofElementrepeated
reasonstringrequiredreward rationale for channel;

ChannelPayoutsMetadata.Body.ChannelPayoutProof.ProofElement

FieldTypeLabelDescription
hashstringrequired
sideChannelPayoutsMetadata.Body.ChannelPayoutProof.Siderequired

ChannelPayoutsMetadata.Header

Fields in the payload header are encoded in fixed length 32/64 bits instead of varint encoding (uint64/32). This allows first calculating, and then setting the byte offset of each ChannelPayoutProof accurately, e.g. byte_offset = size(Header) + position_where_record_for_channel_exists_in_Body If varint encoding is used for header fields, then calculating the byte offset of ChannelPayoutProof w.r.t the start of the payload would be improbable since the header size won't be known.

FieldTypeLabelDescription
payload_length_in_bytesfixed64requiredLength in bytes of entire payload
header_length_in_bytesfixed64requiredLength in bytes of payload header
number_of_channelsfixed32requiredNumber of channels
channel_payout_byte_offsetsChannelPayoutsMetadata.Header.ChannelPayoutByteOffsetrepeatedList of byte offsets for all channels

ChannelPayoutsMetadata.Header.ChannelPayoutByteOffset

FieldTypeLabelDescription
channel_idfixed32requiredChannel id
byte_offsetfixed64requiredByte offset from start of payload where payout record for given channel Id exists

ChannelPayoutsMetadata.Body.ChannelPayoutProof.Side

NameNumberDescription
Left0
Right1

Top

proto/Council.proto

CouncilCandidacyNoteMetadata

FieldTypeLabelDescription
headerstringoptionalCandidacy header text
bullet_pointsstringrepeatedCandidate program in form of bullet points
banner_image_uristringoptionalImage uri of candidate's banner
descriptionstringoptionalCandidacy description (md-formatted)

Top

proto/Forum.proto

ForumPostMetadata

FieldTypeLabelDescription
textstringoptionalPost text content (md-formatted)
repliesTouint32optionalId of the post that given post replies to (if any)

ForumThreadMetadata

FieldTypeLabelDescription
titlestringoptionalThread title
tagsstringrepeatedTags accociated with the thread. Any update overrides all current tags. Only the first {MAX_TAGS_PER_FORUM_THREAD} (const exposed via @joystream/metadata-protobuf/consts) tags are taken into account. In order to unset current tags, [''] (array with empty string) must be provided as value.

Top

proto/Membership.proto

MembershipMetadata

FieldTypeLabelDescription
namestringoptionalMember's real name
avatar_objectuint32optionalMember's avatar - index into external assets array
avatar_uristringoptionalUrl to member's avatar
aboutstringoptionalMember's md-formatted about text
externalResourcesMembershipMetadata.ExternalResourcerepeated

MembershipMetadata.ExternalResource

FieldTypeLabelDescription
typeMembershipMetadata.ExternalResource.ResourceTypeoptional
valuestringoptional

MembershipMetadata.ExternalResource.ResourceType

NameNumberDescription
EMAIL0
HYPERLINK1
TWITTER2
TELEGRAM3
DISCORD4
FACEBOOK5
YOUTUBE6
MATRIX7
IRC8
WECHAT9
WHATSAPP10
LINKEDIN11
GITHUB12

Top

proto/Metaprotocol.proto

AppMetadata

FieldTypeLabelDescription
website_urlstringoptionalUrl where user can read more about the project or company for this app
use_uristringoptionalUrl to the app
small_iconstringoptional
medium_iconstringoptional
big_iconstringoptional
one_linerstringoptionalTagline for the app
descriptionstringoptional
terms_of_servicestringoptional
auth_keystringoptional
platformsstringrepeatedList of platforms on which the app will be available, e.g. [mobile, web, native]
categorystringoptionalE.g messaging, adult

BanOrUnbanMemberFromChannel

FieldTypeLabelDescription
member_iduint64requiredID of the member that channel owner wants to ban from participating on any video.
optionBanOrUnbanMemberFromChannel.OptionrequiredSelected option to ban or unban member from the channel

ChannelModeratorRemarked

FieldTypeLabelDescription
moderate_commentModerateCommentoptional

ChannelOwnerRemarked

FieldTypeLabelDescription
pin_or_unpin_commentPinOrUnpinCommentoptional
ban_or_unban_member_from_channelBanOrUnbanMemberFromChanneloptional
video_reactions_preferenceVideoReactionsPreferenceoptional
moderate_commentModerateCommentoptional

CreateApp

FieldTypeLabelDescription
namestringrequired
app_metadataAppMetadataoptional

CreateComment

create comment

FieldTypeLabelDescription
video_iduint64requiredID of the video
parent_comment_idstringoptionalID of comment member wants to reply (empty if new comment is parent comment)
bodystringrequiredComment text

CreateVideoCategory

FieldTypeLabelDescription
namestringrequired
descriptionstringoptional
parent_category_idstringoptional

DeleteComment

delete comment by author

FieldTypeLabelDescription
comment_idstringrequiredID of the comment which will be deleted

EditComment

edit comment by author

FieldTypeLabelDescription
comment_idstringrequiredID of the comment whose text is being edited
new_bodystringrequiredNew comment body

MakeChannelPayment

FieldTypeLabelDescription
rationalestringoptionalReason why payment is being made
video_iduint64optionalOther possible contexts, e.g. playlist etc.

MemberRemarked

FieldTypeLabelDescription
react_videoReactVideooptional
react_commentReactCommentoptional
create_commentCreateCommentoptional
edit_commentEditCommentoptional
delete_commentDeleteCommentoptional
create_video_categoryCreateVideoCategoryoptional
create_appCreateAppoptional
update_appUpdateAppoptional
make_channel_paymentMakeChannelPaymentoptionalDeleteApp delete_app = 9;

ModerateComment

delete comment by moderator or channel owner;

FieldTypeLabelDescription
comment_idstringrequiredID of comment that will be deleted by moderator
rationalestringrequiredwhy moderator wants to delete this comment

PinOrUnpinComment

pin comment on a video by channel owner

FieldTypeLabelDescription
video_iduint64requiredID of the video
comment_idstringrequiredID of the comment which will be pinned
optionPinOrUnpinComment.OptionrequiredSelected option to pin or unpin comment from channel

ReactComment

reacting, unreacting to a comment

FieldTypeLabelDescription
comment_idstringrequiredID of the comment to react
reaction_iduint32requiredID of the selected reaction

ReactVideo

reacting, unreacting, and changing reaction to video

FieldTypeLabelDescription
video_iduint64requiredID of the video to react
reactionReactVideo.ReactionrequiredSelected reaction

UpdateApp

FieldTypeLabelDescription
app_idstringrequired
app_metadataAppMetadataoptional

VideoReactionsPreference

Enable or disable reactions on a single video

FieldTypeLabelDescription
video_iduint64requiredID of the video
optionVideoReactionsPreference.OptionrequiredSelected option to enable or disable comment section

BanOrUnbanMemberFromChannel.Option

NameNumberDescription
BAN0Ban member (nothing happens if member is already banned)
UNBAN1Unban member (nothing happens if member is already unbanned)

PinOrUnpinComment.Option

NameNumberDescription
PIN0Pin comment on video (nothing happens if comment is already pinned)
UNPIN1Unpin comment from video (nothing happens if comment is already unpinned)

ReactVideo.Reaction

The enum must be wrapped inside "message", otherwide it breaks protobufjs Reacting again with the same message option will cancel the previous reaction

NameNumberDescription
LIKE0
UNLIKE1

VideoReactionsPreference.Option

NameNumberDescription
ENABLE0Enable reactions (nothing happens if they are already enabled)
DISABLE1Disable reactions (nothing happens if they are already disabled)

Top

proto/Person.proto

PersonMetadata

FieldTypeLabelDescription
first_namestringoptional
middle_namestringoptional
last_namestringoptional
aboutstringoptional
cover_photouint32optionalindex into external assets array
avatar_photouint32optionalindex into external assets array

Top

proto/ProposalsDiscussion.proto

ProposalsDiscussionPostMetadata

FieldTypeLabelDescription
textstringoptionalPost text content (md-formatted)
repliesTouint32optionalId of the post that given post replies to (if any)

Top

proto/Series.proto

SeasonMetadata

FieldTypeLabelDescription
titlestringoptional
descriptionstringoptional
cover_photouint32optionalindex into external assets array
personsuint64repeatedPerson(s) referenced by PersonId involved in this Season

SeriesMetadata

FieldTypeLabelDescription
titlestringoptional
descriptionstringoptional
cover_photouint32optionalindex into external assets array
personsuint64repeatedPerson(s) referenced by PersonId involved in this Series

Top

proto/Storage.proto

DistributionBucketFamilyMetadata

FieldTypeLabelDescription
regionstringoptionalID / name of the region covered by the distribution family (ie. us-east-1). Should be unique.
descriptionstringoptionalAdditional, more specific description of the region
areasGeographicalArearepeatedStandarized geographical areas covered by the family (providing [{}] will unset the current value)
latency_test_targetsstringrepeatedList of targets (hosts/ips) best suited latency measurements for this family

DistributionBucketOperatorMetadata

FieldTypeLabelDescription
endpointstringoptionalRoot distribution node endpoint (ie. https://example.com/distribution)
locationNodeLocationMetadataoptionalInformation about node's phisical location (providing {} will unset current value)
extrastringoptionalAdditional information about the node / node operator

GeoCoordiantes

FieldTypeLabelDescription
latitudefloatoptional
longitudefloatoptional

GeographicalArea

FieldTypeLabelDescription
continentGeographicalArea.Continentoptional
country_codestringoptionalISO 3166-1 alpha-2 country code
subdivision_codestringoptionalISO 3166-2 subdivision code

NodeLocationMetadata

FieldTypeLabelDescription
country_codestringoptionalISO 3166-1 alpha-2 country code (2 letters)
citystringoptionalCity name
coordinatesGeoCoordiantesoptionalGeographic coordinates (providing {} will unset current value)

StorageBucketOperatorMetadata

FieldTypeLabelDescription
endpointstringoptionalRoot storage node endpoint (ie. https://example.com/storage)
locationNodeLocationMetadataoptionalInformation about node's phisical location (providing {} will unset current value)
extrastringoptionalAdditional information about the node / node operator

GeographicalArea.Continent

NameNumberDescription
AF1
NA2
OC3
AN4
AS5
EU6
SA7

Top

proto/Token.proto

Benefit

FieldTypeLabelDescription
titlestringoptional
descriptionstringoptional
emojistringoptional
display_orderuint32optional

CreatorTokenIssuerRemarked

FieldTypeLabelDescription
update_token_metadataUpdateTokenMetadataoptional

SaleMetadata

FieldTypeLabelDescription
terms_and_conditionsstringoptional

TokenMetadata

FieldTypeLabelDescription
namestringoptionalTitle
symbolstringoptionalSymbol
descriptionstringoptionaltoken description
avatar_objectuint32optionalavatar for token - index into external assets array
avatar_uristringoptionalUrl to member's avatar
benefitsBenefitrepeatedbenefits for tokne
whitelist_application_notestringoptionalnote for applicant
whitelist_application_apply_linkstringoptionallink to application process
trailer_video_iduint64optionalruntime id for video trailer

UpdateTokenMetadata

FieldTypeLabelDescription
new_metadataTokenMetadataoptional

Top

proto/Video.proto

ContentMetadata

FieldTypeLabelDescription
video_metadataVideoMetadataoptional... Other possible metadata standards, e.g. PlaylistMetadata

License

License types defined by Joystream

FieldTypeLabelDescription
codeuint32optionalLicense code defined by Joystream. reference
attributionstringoptionalText for licenses that require an attribution
custom_textstringoptionalText for custom license type

MediaType

Codec, Container, MIME media-type information

FieldTypeLabelDescription
codec_namestringoptionalCodec corresponding to name field from FFmpeg
containerstringoptionalVideo container format, eg. 'MP4', 'WebM', 'Ogg' ref
mime_media_typestringoptionalMIME Media Type, eg. 'video/mp4' ref

PublishedBeforeJoystream

Publication status before joystream

FieldTypeLabelDescription
is_publishedbooloptionalWas video published before joystream platform
datestringoptionalDate of publication: 'YYYY-MM-DD' ISO-8601

SubtitleMetadata

FieldTypeLabelDescription
typestringrequired
new_assetuint32optionalindex into external assets array
languagestringrequiredISO_639-1 Language Code
mimeTypestringrequired

VideoMetadata

FieldTypeLabelDescription
titlestringoptionalVideo Title
descriptionstringoptionalVideo Description
videouint32optionalindex into external assets array
thumbnail_photouint32optionalindex into external assets array
durationuint32optionalLengths of video in seconds
media_pixel_heightuint32optionalResolution of the video (Height)
media_pixel_widthuint32optionalResolution of the video (Width)
media_typeMediaTypeoptionalEncoding and Container format used
languagestringoptionalISO_639-1 Language Code
licenseLicenseoptionalLicense type for the media
published_before_joystreamPublishedBeforeJoystreamoptionalDate of publication
has_marketingbooloptionalDoes video have marketing or advertising in the stream
is_publicbooloptionalShould video be publicy visible yet
is_explicitbooloptionalDoes Video have explicit language or scenes
personsuint64repeatedPerson(s) referenced by PersonId involved in this video
categorystringoptionalVideo Category Id
subtitlesSubtitleMetadatarepeatedVideo subtitles
enable_commentsbooloptionalEnable/Disable the comment section
clear_subtitlesbooloptionalRemove all subtitles; since protobuf doesn't distinguish b/w empty array and null field, simply removing all subtitles by overriding list with an empty array wont work
is_shortbooloptionalIs video a short format, vertical video (e.g. Youtube Shorts, TikTok, Instagram Reels)

Top

proto/WorkingGroups.proto

AddUpcomingOpening

FieldTypeLabelDescription
metadataUpcomingOpeningMetadataoptionalUpcoming opening metadata

ApplicationMetadata

FieldTypeLabelDescription
answersstringrepeatedList of answers to opening application form questions

ModeratePost

FieldTypeLabelDescription
post_iduint64required
rationalestringrequired

OpeningMetadata

FieldTypeLabelDescription
short_descriptionstringoptionalShort description of the opening
descriptionstringoptionalFull description of the opening
hiring_limituint32optionalExpected number of hired applicants
expected_ending_timestampuint32optionalExpected time when the opening will close (Unix timestamp)
application_detailsstringoptionalMd-formatted text explaining the application process
application_form_questionsOpeningMetadata.ApplicationFormQuestionrepeatedList of questions that should be answered during application
titlestringoptional

OpeningMetadata.ApplicationFormQuestion

FieldTypeLabelDescription
questionstringoptionalThe question itself (ie. "What is your name?"")
typeOpeningMetadata.ApplicationFormQuestion.InputTypeoptionalSuggested type of the UI answer input

RemarkMetadataAction

FieldTypeLabelDescription
moderate_postModeratePostoptional
verify_validatorVerifyValidatoroptional

RemoveUpcomingOpening

FieldTypeLabelDescription
idstringoptionalUpcoming opening query-node id

SetGroupMetadata

FieldTypeLabelDescription
new_metadataWorkingGroupMetadataoptionalNew working group metadata to set (can be a partial update)

UpcomingOpeningMetadata

FieldTypeLabelDescription
expected_startuint32optionalExpected opening start (timestamp)
reward_per_blockuint64optionalExpected reward per block
min_application_stakeuint64optionalExpected min. application stake
metadataOpeningMetadataoptionalOpening metadata

VerifyValidator

FieldTypeLabelDescription
member_iduint64required
is_verifiedboolrequired

WorkingGroupMetadata

FieldTypeLabelDescription
descriptionstringoptionalGroup description text (md-formatted)
aboutstringoptionalGroup about text (md-formatted)
statusstringoptionalCurrent group status (expected to be 1-3 words)
status_messagestringoptionalShort status message associated with the status

WorkingGroupMetadataAction

FieldTypeLabelDescription
set_group_metadataSetGroupMetadataoptional
add_upcoming_openingAddUpcomingOpeningoptional
remove_upcoming_openingRemoveUpcomingOpeningoptional

OpeningMetadata.ApplicationFormQuestion.InputType

NameNumberDescription
TEXTAREA0
TEXT1

Scalar Value Types

.proto TypeNotesC++JavaPythonGoC#PHPRuby
doubledoubledoublefloatfloat64doublefloatFloat
floatfloatfloatfloatfloat32floatfloatFloat
int32Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead.int32intintint32intintegerBignum or Fixnum (as required)
int64Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead.int64longint/longint64longinteger/stringBignum
uint32Uses variable-length encoding.uint32intint/longuint32uintintegerBignum or Fixnum (as required)
uint64Uses variable-length encoding.uint64longint/longuint64ulonginteger/stringBignum or Fixnum (as required)
sint32Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s.int32intintint32intintegerBignum or Fixnum (as required)
sint64Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s.int64longint/longint64longinteger/stringBignum
fixed32Always four bytes. More efficient than uint32 if values are often greater than 2282^{28}.uint32intintuint32uintintegerBignum or Fixnum (as required)
fixed64Always eight bytes. More efficient than uint64 if values are often greater than 2562^{56}.uint64longint/longuint64ulonginteger/stringBignum
sfixed32Always four bytes.int32intintint32intintegerBignum or Fixnum (as required)
sfixed64Always eight bytes.int64longint/longint64longinteger/stringBignum
boolboolbooleanbooleanboolboolbooleanTrueClass/FalseClass
stringA string must always contain UTF-8 encoded or 7-bit ASCII text.stringStringstr/unicodestringstringstringString (UTF-8)
bytesMay contain any arbitrary sequence of bytes.stringByteStringstr[]byteByteStringstringString (ASCII-8BIT)

Referencing Assets

Applications that process messages that contain a uint32 field that references an asset such as a cover photo or video, should interpret this value as a zero based index into an array/vector that is received external (out of band) to the protobuf message.

Example in context of query-node processing the runtime event VideoCreated

// Runtime event associated with creating a Video
VideoCreated(video_id: VideoId, video: Video, assets: Vec<NewAsset>, params: VideoCreationParameters)

struct VideoCreationParameters {
  in_category: VideoCategoryId,
  // binary serialized VideoMetadata protobuf message
  meta: Vec<u8>,
}

// suppose assets is a vector of two elements. This is the "out of band" array being referenced by the VideoMetadata message
assets = [
    NewAsset::Uri("https://mydomain.net/thumbnail.png"),
    NewAsset::Upload({
       content_id,
       ipfs_hash,
       size,
       ...
    }),
];

meta = VideoMetadata {
    ...
    // refers to second element: assets[1] which is being uploaded to the storage system
    video: 1,
    // refers to the first element assets[0] which is being referneced by a url string.
    thumbnail_photo: 0,
    ...
};