# Create a post

Note

Upon completing this challenge, you will be rewarded 20 Desmos Tokens.

Please note that in order to prevent spam, you will receive the reward just for the first post you create. No tokens will be awarded for later posts.

Inside Desmos, posts are the way that users have to share publicly whatever they want.

You can see posts much like tweets on Twitter, as they have the same functionality: they allow you to write what you wish (without any length limitation) and they are publicly visible to all the Desmos users.

The only difference with tweets is that once you've created a Desmos post you will not be able to delete it! This is due to the blockchain's intrinsic characteristic of being immutable: each transaction that is performed cannot be undone.

Know more about posts

If you want to know more about posts and how they are composed of, including the poll data, please refer to the official Desmos documentation

# Creating your first post

After you've followed the setup and you've created your Desmos account using the desmoscli keys command, you are ready to create your first post. To do so, run the following command:

desmoscli tx posts create "<Subspace>" "<Message>" true --from <your-key-name> --yes 

# Example
# desmoscli tx posts create "desmos" "Hello world!" true --from jack --yes
1
2
3
4

You will be asked to type the password you've chosen during the setup and after having inserted it properly you should see something like this:

height: 0
txhash: 89243E31ED012CC0AE541C56983946E4BBE1D830DF71B2D0E2EB79CB37BE5231
code: 0
data: ""
rawlog: '[{"msg_index":0,"success":true,"log":"","events":[{"type":"message","attributes":[{"key":"action","value":"create_post"}]}]}]'
logs:
- msgindex: 0
  success: true
  log: ""
  events:
  - type: message
    attributes:
    - key: action
      value: create_post
info: ""
gaswanted: 0
gasused: 0
codespace: ""
tx: null
timestamp: ""
events: []
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

To make sure the transaction has been processed successfully, you can query it using the following command:

desmoscli query tx <hash> --output json

# Example
# desmoscli query tx 89243E31ED012CC0AE541C56983946E4BBE1D830DF71B2D0E2EB79CB37BE5231 --output json
1
2
3
4

This will return you the JSON representation of the transaction itself.

Hello world!

Congratulations! You've just created your first Desmos post!

# Getting the reward

After you've created a post, to make sure you receive your reward please following this procedure:

  1. Create a fork of this repo inside your private GitHub profile.
    If you do not know how to do it, follow the GitHub fork guide.

  2. Pull the fork locally:

    git clone https://github.com/<your-name>/primer.git ~/desmos-primer
    cd ~/desmos-primer
    
    1
    2
  3. Create a file named after your GitHub username containing the post creation transaction hash:

    echo "<tx-hash>" >> ./phases/phase-1/challenges/posts/<your-github-name>
    
    # Example
    # echo "89243E31ED012CC0AE541C56983946E4BBE1D830DF71B2D0E2EB79CB37BE5231" >> ./phases/phase-1/challenges/posts/RiccardoM
    
    1
    2
    3
    4
  4. Commit the changes, push them to your forked repo and create a pull request. If you do not know how to create one, refer to the GitHub Pull Requests guide.

Last Updated: 7/16/2020, 4:47:35 AM