Steem Developer Portal
This is a brief overview of the parameters allowed and values passed by the ‘comment’ operation in the broadcast API
Additional info for API definitions is available on the dev portal
Purpose:
A broadcast operation on Steem is a way of expressing intention on the blockchain. It is used to transmit signed transactions to the Steem network.
There are various broadcast types, in this instance we are focusing specifically on the comment operation.
Each of the broadcast operations have parameters that are passed with the specific method in order to affect the required change to the blockchain.
In other words, the broadcast.comment operation creates a comment or a post (post are also defined as comments) on the Steem blockchain.
Rules:
- The “title” must not be longer than 256 bytes
- The “title” must be UTF-8
- The “body” must be larger than 0 bytes
- The “body” much also be UTF-8
Parameters:
- parent_author - the author that comment is being submitted to, when posting a new blog this is an empty string
- parent_permlink - specific post that comment is being submitted to, when posting a new blog this is an empty string
- author - author of the post/comment being submitted (account name)
- permlink - unique string identifier for the post, linked to the author of the post
- title - human readable title of the post being submitted, this is often blank when commenting
- body - body of the post/comment being submitted, or diff-match-patch when updating
- json_metadata - JSON object string
Additional Parameter Definitions:
- permlink:
Two authors may have the same permlink as it’s unique to the author only. For example, there could be two authors, alice and bob, and both could have a permlink of
firstpost - json_metadata: There is no blockchain enforced validation on json_metadata, but the community has adopted a particular structure.
- It should contain a JSON object with the following keys:
- tags - An array of up to 5 strings. Although the blockchain will accept more than 5, the tags plugin only looks at the first five
- app - A user agent style application identifier. Typically app_name.version, e.g. steemit/0.1
- format - The format of the body, e.g. markdown
- In addition to the above keys, application developers are free to add any other keys they want to help manage the content they broadcast.
A typical comment operation would look similar to the below:
const post = {
author :"Joe",
title :"A post by Joe",
body :"Look at my awesome post",
parent_author :'',
parent_permlink :"steem",
permlink :"a-post-by-joe",
json_metadata :"{\"tags\":[\"steemit\",\"example\",\"tags\"]}",
};
In which case the complete broadcast operation would look like this:
broadcast.comment(post, privatePostingKey)
With privatePostingKey being the private posting key of the author broadcasting the comment or post
Create_vs_Update:
When a comment is first broadcast, the permlink must be unique for the author. Otherwise, it is interpreted as an update operation. Updating will either replace the entire body with the latest operation or patch the body if using diff-match-patch.
For example, if we have a paragraph that has already been broadcast:
“It’s been quite a lot of fun working with these wonderful folk at Steemit, Inc”
And we want to change it to:
“It’s been quite a lot of fun working with these wonderful people at Steemit, Inc”
We can broadcast the comment operation with the following body:
- ”@@ -406,12 +406,14 @@”
- ful
- -folk
- +people
- at
The blockchain will know that this means we have changed the word ‘folk’ to ‘people’ within that paragraph so when fetching this content, this diff will be applied.
In addition to body, the title and json_metadata fields will also be replaced by the latest operation.
Comment_Options: LINK
Updating_Archived_Content:
Content that is older than 7 days is considered “archived” and cannot be edited unless the author indicates otherwise by broadcasting a custom_json to the witness plugin using their active authority.
As of HF18, the witness plugin has a custom operation called enable_content_editing that allows a user to signal they want to edit their content. By consensus, content is editable indefinitely, but is soft forked to be frozen after payout. This operation requires an active key and is designed to prevent vandalism if a posting key is compromised.
For ‘custom_json’: LINK
Vote: LINK
It should also be noted that a vote operation can accompany a comment in the same transaction when the author self_upvotes