<center></center> This tutorial is part of a series where we explain different aspects of programming with `steem-python`. Links to the other tutorials can be found below. You will learn how `steem-python` can be used to post an article from file directly to the Steem blockchain as well as built and broadcast a transaction to purchase an upvote for the article posterd. --- #### What will I learn - What submitting a post looks like in `steem-python` - Creating an unique permlink - How a transaction is built - How to broadcast a transaction #### Requirements - Python 3.6 - `steem-python` #### Difficulty - Basic --- ### Tutorial #### Set up Start by downloading both files from [github](https://github.com/amosbastian/steempy-tutorials/tree/master/part_5). The `post.txt` is used to store the post we want to submit and the title and tags we would like to use. The first line is used for the title and the second line is for the tags, separated by a whitespace. The rest of the file is the body of the post. ``` #1 Title 'Test' Buy Upvote #2 blog test steemdev #3 <center> #4 Test buying upvote from minnowbooster #5 </center> ``` In `scheduler.py` you will have to set the author, the upvote bot you want to use and what amount in SBD you want to buy upvotes for. ``` author = 'sttest2' upvote_bot = 'minnowbooster' amount = 0.05 ``` <br> #### What does submitting a post look like? Submitting a post with `steem-python` requires several variables. Most of them are optional. We will be using the title, body, author, permlink and self_vote. ``` def post(self, title, body, author, permlink=None, reply_identifier=None, json_metadata=None, comment_options=None, community=None, tags=None, beneficiaries=None, self_vote=False): ``` Calling the post function to submit the post then looks like: `steem.post(title, body, author, permlink, None, None, None, None, tags, None, True)` ##### Permlink The permlink is an unique identifier for each post, which is linked to the author of the post. Leaving this blank `steem-python` will automatically assign a permlink based on the title. However, the permlink is needed to buy an upvote, therefor a permlink needs be to created from the title. To make sure the permlink created is unique and valid all characters except for letters and numbers will be removed, as well as capitals. A random number and a timestamp will be added as well. ``` permlink_title = ''.join(e for e in title if e.isalnum()).lower() permlink = "{}-%s%s".format(permlink_title) % (time.strftime("%Y%m%d%H%M%S"), random.randrange(0,9999,1)) ``` #### How is a transaction built? A transaction is built up by a sender, receiver, amount in SBD/STEEM and an optional memo in a dict. For sender the author will b used and the receiver will be the upvote_bot. SBD will be used and the memo will be full url to the article, including permlink and author. ``` transfers =[{ 'from': author, 'to': upvote_bot, 'amount': 'amount SBD', 'memo': 'full url to post' }] ``` The full url to the post can be created with the permlink and author as follows: ``` 'https://steemit.com/@{}/{}'.format(author, permlink) ``` The next code is then used to sign and broadcast the transaction ``` tb = Transactionbuilter() operation = [operations.Transfer(**x) for x in transfers] tb.appendOps(operation) tb.appendSigner(author, 'active') tb.sign() tx = tb.broadcast() ``` **Note**: `transfers` is a list with transactions. Each transaction is put in a dict. This allows for multiple transactions to be broadcasted at once. Like for example if you wish to purchase multiple upvotes from several upvote bots. #### Running the code Now that you have configured the code to your own liking you can test it for yourself. > python scheduler.py Submitted post Buying vote succes  #### Curriculum - [Part 0: How To Install Steem-python, The Official Steem Library For Python](https://utopian.io/utopian-io/@amosbastian/how-to-install-steem-python-the-official-steem-library-for-python) - [Part 1: How To Configure The Steempy CLI Wallet And Upvote An Article With Steem-Python](https://utopian.io/utopian-io/@steempytutorials/part-1-how-to-configure-the-steempy-cli-wallet-and-upvote-an-article-with-steem-python) - [Part 2: How To Stream And Filter The Blockchain Using Steem-Python](https://steemit.com/utopian-io/@steempytutorials/part-2-how-to-stream-and-filter-the-blockchain-using-steem-python) - [Part 3: Creating A Dynamic Upvote Bot That Runs 24/7](https://steemit.com/utopian-io/@steempytutorials/part-3-creating-a-dynamic-upvote-bot-that-runs-24-7-first-weekly-challenge-3-steem-prize-pool) - [Part 4: How To Follow A Voting Trail Using Steem-Python](https://steemit.com/utopian-io/@steempytutorials/part-4-how-to-follow-a-voting-trail-using-steem-python) #### Credits This tutorial was written by @juliank in conjunction with @amosbastian --- The code for this tutorial can be found on [GitHub](https://github.com/amosbastian/steempy-tutorials/tree/master/part_5)! <br /><hr/><em>Posted on <a href="https://utopian.io/utopian-io/@steempytutorials/part-5-post-an-article-directly-to-the-steem-blockchain-and-automatically-buy-upvotes-from-upvote-bots">Utopian.io - Rewarding Open Source Contributors</a></em><hr/>
author | steempytutorials | ||||||
---|---|---|---|---|---|---|---|
permlink | part-5-post-an-article-directly-to-the-steem-blockchain-and-automatically-buy-upvotes-from-upvote-bots | ||||||
category | utopian-io | ||||||
json_metadata | {"community":"utopian","app":"utopian/1.0.0","format":"markdown","repository":{"id":84843862,"name":"steem-python","full_name":"steemit/steem-python","html_url":"https://github.com/steemit/steem-python","fork":false,"owner":{"login":"steemit"}},"pullRequests":[],"platform":"github","type":"tutorials","tags":["utopian-io","steemdev","programming","python","tutorial"],"users":["juliank","amosbastian"],"links":["https://github.com/amosbastian/steempy-tutorials/tree/master/part_5","https://utopian.io/utopian-io/@amosbastian/how-to-install-steem-python-the-official-steem-library-for-python","https://utopian.io/utopian-io/@steempytutorials/part-1-how-to-configure-the-steempy-cli-wallet-and-upvote-an-article-with-steem-python","https://steemit.com/utopian-io/@steempytutorials/part-2-how-to-stream-and-filter-the-blockchain-using-steem-python","https://steemit.com/utopian-io/@steempytutorials/part-3-creating-a-dynamic-upvote-bot-that-runs-24-7-first-weekly-challenge-3-steem-prize-pool","https://steemit.com/utopian-io/@steempytutorials/part-4-how-to-follow-a-voting-trail-using-steem-python","https://utopian.io/utopian-io/@steempytutorials/part-5-post-an-article-directly-to-the-steem-blockchain-and-automatically-buy-upvotes-from-upvote-bots"],"image":["https://res.cloudinary.com/hpiynhbhq/image/upload/v1515886103/kmzfcpvtzuwhvqhgpyjp.png","https://steemitimages.com/DQmdYb9K2i3jsgb7Cd1GZZ3M7FAGmVN1MEuGebzvaytQYXe/Screenshot%202018-01-16%2017.09.40.png"],"moderator":{"account":"jestemkioskiem","time":"2018-01-16T21:05:41.098Z","reviewed":true,"pending":false,"flagged":false}} | ||||||
created | 2018-01-16 17:07:57 | ||||||
last_update | 2018-01-16 23:00:09 | ||||||
depth | 0 | ||||||
children | 8 | ||||||
last_payout | 2018-01-23 17:07:57 | ||||||
cashout_time | 1969-12-31 23:59:59 | ||||||
total_payout_value | 29.418 HBD | ||||||
curator_payout_value | 9.559 HBD | ||||||
pending_payout_value | 0.000 HBD | ||||||
promoted | 0.000 HBD | ||||||
body_length | 5,707 | ||||||
author_reputation | 31,094,047,689,691 | ||||||
root_title | "Part 5: Post An Article Directly To The Steem Blockchain And Automatically Buy Upvotes From Upvote Bots" | ||||||
beneficiaries |
| ||||||
max_accepted_payout | 1,000,000.000 HBD | ||||||
percent_hbd | 10,000 | ||||||
post_id | 29,985,078 | ||||||
net_rshares | 5,304,454,036,531 | ||||||
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
jza | 0 | 0 | 100% | ||
justusagenstum | 0 | 70,182,058,247 | 100% | ||
remlaps1 | 0 | 28,913,487,623 | 30% | ||
fratheone | 0 | 853,864,428 | 100% | ||
lisa.palmer | 0 | 2,738,400,123 | 30% | ||
nicnas | 0 | 20,181,906,807 | 50% | ||
juliank | 0 | 1,332,705,099,506 | 100% | ||
eni198881 | 0 | 264,923,355 | 100% | ||
muksal.mina | 0 | 595,794,641 | 100% | ||
luisrod | 0 | 605,286,229 | 100% | ||
hidayat96 | 0 | 237,020,640 | 100% | ||
coolguy123 | 0 | 2,172,007,364 | 1% | ||
utopian-io | 0 | 3,831,766,941,022 | 2.63% | ||
travoved | 0 | 4,351,924,920 | 70% | ||
devasish | 0 | 230,745,000 | 100% | ||
amosbastian | 0 | 1,869,289,365 | 100% | ||
fisherck | 0 | 2,880,041,691 | 100% | ||
andresrey | 0 | 606,322,863 | 100% | ||
steempytutorials | 0 | 242,236,427 | 100% | ||
praiserider | 0 | 147,590,051 | 100% | ||
johangericke | 0 | 1,446,841,806 | 100% | ||
hismuse | 0 | 362,555,000 | 100% | ||
danielcares | 0 | 583,541,204 | 100% | ||
luj1 | 0 | 516,158,219 | 100% | ||
junda | 0 | 0 | 100% |
iss it right
author | azizulhassan |
---|---|
permlink | re-steempytutorials-part-5-post-an-article-directly-to-the-steem-blockchain-and-automatically-buy-upvotes-from-upvote-bots-20180117t194826458z |
category | utopian-io |
json_metadata | {"tags":["utopian-io"],"app":"steemit/0.1"} |
created | 2018-01-17 19:48:27 |
last_update | 2018-01-17 19:48:27 |
depth | 1 |
children | 0 |
last_payout | 2018-01-24 19:48:27 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 12 |
author_reputation | 858,685,273,941 |
root_title | "Part 5: Post An Article Directly To The Steem Blockchain And Automatically Buy Upvotes From Upvote Bots" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 30,243,999 |
net_rshares | 0 |
Thank you for the contribution. It has been approved. You can contact us on [Discord](https://discord.gg/uTyJkNm). **[[utopian-moderator]](https://utopian.io/moderators)**
author | jestemkioskiem |
---|---|
permlink | re-steempytutorials-part-5-post-an-article-directly-to-the-steem-blockchain-and-automatically-buy-upvotes-from-upvote-bots-20180116t205817623z |
category | utopian-io |
json_metadata | {"tags":["utopian-io"],"community":"utopian","app":"utopian/1.0.0"} |
created | 2018-01-16 20:58:21 |
last_update | 2018-01-16 20:58:21 |
depth | 1 |
children | 1 |
last_payout | 2018-01-23 20:58:21 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.277 HBD |
curator_payout_value | 0.089 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 172 |
author_reputation | 41,292,066,961,817 |
root_title | "Part 5: Post An Article Directly To The Steem Blockchain And Automatically Buy Upvotes From Upvote Bots" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 30,024,687 |
net_rshares | 41,217,683,489 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
juliank | 0 | 41,217,683,489 | 3% |
Much appreciated!
author | juliank |
---|---|
permlink | re-jestemkioskiem-re-steempytutorials-part-5-post-an-article-directly-to-the-steem-blockchain-and-automatically-buy-upvotes-from-upvote-bots-20180116t220724792z |
category | utopian-io |
json_metadata | {"tags":["utopian-io"],"app":"steemit/0.1"} |
created | 2018-01-16 22:07:24 |
last_update | 2018-01-16 22:07:24 |
depth | 2 |
children | 0 |
last_payout | 2018-01-23 22:07:24 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 17 |
author_reputation | 117,823,071,447,502 |
root_title | "Part 5: Post An Article Directly To The Steem Blockchain And Automatically Buy Upvotes From Upvote Bots" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 30,035,183 |
net_rshares | 240,724,088 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
hidayat96 | 0 | 240,724,088 | 100% |
Thank you for the contribution. It has been approved. You can contact us on [Discord](https://discord.gg/uTyJkNm). **[[utopian-moderator]](https://utopian.io/moderators)**
author | jestemkioskiem |
---|---|
permlink | re-steempytutorials-part-5-post-an-article-directly-to-the-steem-blockchain-and-automatically-buy-upvotes-from-upvote-bots-20180116t210546973z |
category | utopian-io |
json_metadata | {"tags":["utopian-io"],"community":"utopian","app":"utopian/1.0.0"} |
created | 2018-01-16 21:05:48 |
last_update | 2018-01-16 21:05:48 |
depth | 1 |
children | 0 |
last_payout | 2018-01-23 21:05:48 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 172 |
author_reputation | 41,292,066,961,817 |
root_title | "Part 5: Post An Article Directly To The Steem Blockchain And Automatically Buy Upvotes From Upvote Bots" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 30,025,878 |
net_rshares | 0 |
This is a great article, I wonder if its still current with the latest Steem hard forks. But definetly a great post.
author | jza |
---|---|
permlink | re-steempytutorials-part-5-post-an-article-directly-to-the-steem-blockchain-and-automatically-buy-upvotes-from-upvote-bots-20180914t213539236z |
category | utopian-io |
json_metadata | {"tags":["utopian-io"],"app":"steemit/0.1"} |
created | 2018-09-14 21:35:42 |
last_update | 2018-09-14 21:35:42 |
depth | 1 |
children | 0 |
last_payout | 2018-09-21 21:35:42 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 116 |
author_reputation | 38,025,632,925,704 |
root_title | "Part 5: Post An Article Directly To The Steem Blockchain And Automatically Buy Upvotes From Upvote Bots" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 71,309,555 |
net_rshares | 0 |
Good post, I am a photographer, it passes for my blog and sees my content, I hope that it should be of your taste :D greetings
author | sorn1992 |
---|---|
permlink | re-steempytutorials-part-5-post-an-article-directly-to-the-steem-blockchain-and-automatically-buy-upvotes-from-upvote-bots-20180117t154330882z |
category | utopian-io |
json_metadata | {"tags":["utopian-io"],"app":"steemit/0.1"} |
created | 2018-01-17 15:40:36 |
last_update | 2018-01-17 15:40:36 |
depth | 1 |
children | 0 |
last_payout | 2018-01-24 15:40:36 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 126 |
author_reputation | 276,397,313,897 |
root_title | "Part 5: Post An Article Directly To The Steem Blockchain And Automatically Buy Upvotes From Upvote Bots" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 30,198,448 |
net_rshares | 0 |
### Hey @steempytutorials I am @utopian-io. I have just upvoted you! #### Achievements - You have less than 500 followers. Just gave you a gift to help you succeed! - Seems like you contribute quite often. AMAZING! #### Suggestions - Contribute more often to get higher and higher rewards. I wish to see you often! - Work on your followers to increase the votes/rewards. I follow what humans do and my vote is mainly based on that. Good luck! #### Get Noticed! - Did you know project owners can manually vote with their own voting power or by voting power delegated to their projects? Ask the project owner to review your contributions! #### Community-Driven Witness! I am the first and only Steem Community-Driven Witness. <a href="https://discord.gg/zTrEMqB">Participate on Discord</a>. Lets GROW TOGETHER! - <a href="https://v2.steemconnect.com/sign/account-witness-vote?witness=utopian-io&approve=1">Vote for my Witness With SteemConnect</a> - <a href="https://v2.steemconnect.com/sign/account-witness-proxy?proxy=utopian-io&approve=1">Proxy vote to Utopian Witness with SteemConnect</a> - Or vote/proxy on <a href="https://steemit.com/~witnesses">Steemit Witnesses</a> [](https://steemit.com/~witnesses) **Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x**
author | utopian-io |
---|---|
permlink | re-steempytutorials-part-5-post-an-article-directly-to-the-steem-blockchain-and-automatically-buy-upvotes-from-upvote-bots-20180117t134406525z |
category | utopian-io |
json_metadata | {"tags":["utopian-io"],"community":"utopian","app":"utopian/1.0.0"} |
created | 2018-01-17 13:44:06 |
last_update | 2018-01-17 13:44:06 |
depth | 1 |
children | 0 |
last_payout | 2018-01-24 13:44:06 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 1,514 |
author_reputation | 152,955,367,999,756 |
root_title | "Part 5: Post An Article Directly To The Steem Blockchain And Automatically Buy Upvotes From Upvote Bots" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 30,174,706 |
net_rshares | 0 |
@steempytutorials, How will I specify the POSTING Key of the steem user? To auto post the article on a certain schedule.
author | yehey |
---|---|
permlink | re-steempytutorials-part-5-post-an-article-directly-to-the-steem-blockchain-and-automatically-buy-upvotes-from-upvote-bots-20180531t221150264z |
category | utopian-io |
json_metadata | {"tags":["utopian-io"],"users":["steempytutorials"],"app":"steemit/0.1"} |
created | 2018-05-31 22:11:51 |
last_update | 2018-05-31 22:11:51 |
depth | 1 |
children | 0 |
last_payout | 2018-06-07 22:11:51 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 121 |
author_reputation | 22,184,787,552,504 |
root_title | "Part 5: Post An Article Directly To The Steem Blockchain And Automatically Buy Upvotes From Upvote Bots" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 0 |
post_id | 58,664,329 |
net_rshares | 0 |