Let's say I want to store my notes for the books I have read, on a decentralized blockchain.
Creating a post may not be the perfect fit since generally notes are very short-form content and you don't expect everyone to see it on interfaces like Steemit or Busy.
custom_json
Steem blockchain has a custom_json operation which you can actually post any type of JSON data into the blockchain. It's not really a post or comment so it doesn't show up in the Steemit.
Let's post a quote from the book "Code Complete".
from steem import Steem
from steem.transactionbuilder import TransactionBuilder
from steembase import operations
s = Steem(nodes=["https://rpc.buildteam.io"],
keys=["posting_key"])
account = "emrebeyler"
ops = [
operations.CustomJson(**{
"from": account,
"id": "notes.books",
"json": [
'add-quote',
{
"book": "Code complete",
"quote": "Reduce complexity. The single most important reason "
"to create a routine is to reduce a program's "
"complexity. Create a routine to hide information"
" so that you won't need to think about it."
}
],
"required_auths": [],
"required_posting_auths": ["emrebeyler"],
}),
]
tb = TransactionBuilder()
tb.appendOps(ops)
tb.appendSigner(account, "posting")
tb.sign()
tb.broadcast()
And after a couple of quotes, if I ever want to see my quotes:
import json
from steem.account import Account
account = Account('emrebeyler')
for custom_json in account.history_reverse(filter_by=["custom_json"]):
if custom_json["id"] == "notes.books":
action, data = json.loads(custom_json.get("json"))
print("Book: %s\n Quote: %s" % (data["book"], data["quote"]))
Which will result like that:
Pretty cool, huh? I am not sure if any of the 3rd party apps utilizing custom_json yet but it seems Hivemind will utilize it for the communities feature.