# TxComments

#### Blockchain operations

* comment

#### Columns

| Name             | Description                                                                                       |
| ---------------- | ------------------------------------------------------------------------------------------------- |
| author           | author of the post/comment (username)                                                             |
| permlink         | a unique string identifier for the post, linked to the author of the post                         |
| 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 |
| title            | human-readable title of the post being submitted. This is left blank for comments                 |
| body             | body of the post/comment being submitted, or `diff-match-patch` when updating                     |
| json\_metadata   | JSON object string containing post or comment metadata                                            |

#### Description

This operation is used to create or update posts and comments.

* `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. `hiveblog/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.

**Create vs. Update**

When a comment is first broadcasted, the `permlink` must be unique for the `author`. Otherwise, it is interpreted as an update operation. Updates either replace the entire body with the latest operation or patch the body if using [`diff-match-patch`](https://github.com/google/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 on the Open Hive Network”

and it's changed to :

> “It’s been quite a lot of fun working with these wonderful people on the Open Hive Network”

the `comment` operation will have the following `body`:

```
- "@@ -406,12 +406,14 @@"
- ful
- -folk
- +people
- at
```

In addition to `body`, the `title` and `json_metadata` fields are also replaced by the latest operation.
