steem-python for dummies #4 - Private memos
Hello,
This is the 4. post of "steem-python for dummies" series. If you didn't read the older ones, take your time and have a look.
- steem-python for dummies #1 - Introduction and Basic Operations
- steem-python for dummies #2 - Playing with account data
- steem-python for dummies #3 - Coding an upvote bot
In this post, we will learn about private memos.
Private memos
All steem transfer operations are public. Everyone can see it. But if you want to attach a private message between sender and receiver, you have an option to encrpypt the message and send it like this.
Steemit interface already supports this functionality. Only thing you should do is just adding a "#" char to the start of the message.
# This is secret. Nobody should see this.
Using private memos in steem-python
It's dead simple. Just add # to the beginning of the memo.
s = Steem(keys=["PRIVATE_MEMO_KEY"])
s.commit.transfer(
"emrebeyler",
0.001,
"SBD",
memo="#test message",
account="sender_account"
)
Tip: Currently steem-python package has a little bug when sending private memos. It add one extra "#" char to the beginning of the memo. It doesn't break the functionality but if you want to get rid of that, you can apply this patch:
remove double "#" char in private memos
Also, note that, private memo key is required to encrypt/decrpty memo keys.
Here is my private message's string representation on the network
Reading private memos
Steem-python's Memo class has a helper do decode memos. All you need is just passing memo private key and the encoded string. It will return the encoded message.
from steembase import memo as Memo
from steembase.account import PrivateKey
print(Memo.decode_memo(
PrivateKey("MEMO_PRIVATE_KEY"),
"#Jj3eUdmGhs9dbee5crcPTA7hXybBw6TvkEG7NvLVsxTTnb4AHmLeYmQ58r4K4GTLGHZX8BcESDSP6reVz7toZF7xYT88eytJxuS1ChCsKHRKJY3MUyShcJhy36wGX1W31",
))
Use cases
- Private messages (Only sender and receiver can decode it.)
- 3rd party applications can make use of it. Like If I want to see balance on my minnowbooster account, minnowbooster can send the amount with a private memo.
That's all for this post. Feel free to ask questions or request topics about steem-python for the incoming posts.
Posted on Utopian.io - Rewarding Open Source Contributors
Thank you. Sometimes all it takes is little hints like these to get started :)
Glad you liked it.
This series are based on my personal experience w/ steem-python and it includes a lot of gotchas around it which may be helpful for onboarding python devs.
Senin hızına yetişemesem de koşturmaya çalışıyorum. Yalnız kod olayları yakışıyor senin postlara bilgin olsun :))
teşekkürler, her gün 1 tane yazmak istiyordum normalde ama bu sefer arayı biraz uzattık.
Congratulations! This post has been upvoted from the communal account, @minnowsupport, by Emrebeyler from the Minnow Support Project. It's a witness project run by aggroed, ausbitbank, teamsteem, theprophet0, someguy123, neoxian, followbtcnews/crimsonclad, and netuoso. The goal is to help Steemit grow by supporting Minnows and creating a social network. Please find us in the Peace, Abundance, and Liberty Network (PALnet) Discord Channel. It's a completely public and open space to all members of the Steemit community who voluntarily choose to be there.
Thank you for the contribution. It has been approved.
You can contact us on Discord.
[utopian-moderator]
thank you.
Umarım onay alırsınız 😊
alıyor genelde, sıkıntı olmadı hiç. :)
Time is a river,this is 2 years old !BEER
Great post!!!
I will look into this when i start help developing on utopian!!
Hey @emrebeyler I am @utopian-io. I have just upvoted you at 7% Power!
Achievements
Suggestions
Human Curation
Community-Driven Witness!
I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!
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
View or trade
BEER
.Hey @emrebeyler, here is a little bit of
BEER
from @isnochys for you. Enjoy it!