I.T. Spices The LINUX Way

Words
304
Reading
2 min
Listen
Play
9y

TRANSFERS: STEEM Blockchain Data Gathering - Post #43

Christmas is fast approaching as evidenced by my wife’s baked fresh coconut macaroons……...

--

STEEM BLOCKCHAIN DATA EXTRACTION INVOLVING TRANSFERS

It may be beneficial if you read my previous post #42 as it is related to this post, link below.

In this post I will give examples and specific commands to be able to extract any level of data as carried by the STEEM blockchain. It is worth noting that this is a play-around, a way to extract data per file as arranged, one million blocks per file, one block per line.

These examples assumes that the blockchain data are gathered on a file with one million lines and is laid down for educational purposes on the how-to as far as parsing is concerned.

--

-1. TRANSFER from a certain account (randowhale for example)

+++++++++++++++++++++++++++++
cat SAMPLEJSON1 | jq -c '.[] | .transactions[].operations[] | select(.[] == "transfer")' | sed -e 's/["transfer",//g; s/]//g' | jq '{"from","to","amount"} | select(.from == "randowhale")'
+++++++++++++++++++++++++++++

--

-2. TRANSFER to a certain account (randowhale for example)

+++++++++++++++++++++++++++++
cat SAMPLEJSON1 | jq -c '.[] | .transactions[].operations[] | select(.[] == "transfer")' | sed -e 's/["transfer",//g; s/]//g' | jq '{"from","to","amount"} | select(.to == "randowhale")'
+++++++++++++++++++++++++++++

--

-3. ALL TRANSFERS regardless; this will include the memo

+++++++++++++++++++++++++++++
cat SAMPLEJSON1 | jq '.[] | .transactions[].operations[] | select(.[] == "transfer")' --sort-keys
+++++++++++++++++++++++++++++

--

All data as displayed are pre-formatted to become real JSON using the python script. It is worth noting that it took me a while to discover that the output of the STEEM blockchain from the get_blocks_range call is actually not a real JSON.

Real JSON formatted texts should be in double-quotes in order for the versatile jq utility to parse it properly for further scrutiny and formatting.

I will be discussing the other transactions on the next installment posts.

Previous Posts:
https://steemit.com/knowledge/@lightingmacsteem/5iquxp-i-t-spices-the-linux-way

“Life Is Like A Box Of Chocolates; You Never Really Know What You Will Get. -Forrest Gump”

I.T. Spices The LINUX Way | Ecency