Domain Steem with JavaScript: Lesson #3 - Hearing the blockchain

in #steemjs-s22w33 days ago

Hearing the blockchain.png

Edited by Canva

Hello steemians,

Here is my homework for SLC22 Week 3, with the corresponding tasks assigned by @alejos7ven!

What uses would you give to the streamOperations method? (Not to mention those explained the lesson)

The streamOperations method allows continuous listening to events on the Steem blockchain in real time, offering a wide range of innovative and practical applications and Here are some new ideas for use:

Tracking charitable projects and donations in real time

I can use this method to monitor transactions related to charitable initiatives, for example, by filtering transactions with a specific comment or tag, I can establish a dashboard showing the amounts raised, the donors and the impact of the campaigns .

Creating a live stream for new users

I can develop a functionality to welcome and track new registrants by detecting their first interactions on the blockchain, this includes the first publications, comments or votes, I can also automate welcome messages to quickly integrate them into the community.

Detection of emerging trends

By analyzing the most used keywords or hashtags in real time, I can identify topics or discussions that are gaining momentum, which can be useful for creating relevant content or guiding community discussions.

Engagement cycle analysis

I can track periods of maximum activity on the blockchain, such as peaks in votes, posts or transfers, in order to optimize posts or plan events based on the most favorable times.

Automation of recognition systems

I can design a program that automatically awards badges or rewards to users based on their contributions, for example, by monitoring interactions such as votes received or given, I can create a fun system to encourage engagement.

Blockchain investment tools

By tracking large transactions or recurring transfers, I can develop an analytics platform for investors to identify fund movement trends or key account strategies.

Blockchain archiving and documentation

I can use streamOperations to archive blockchain activities in real time to provide a searchable database for future analysis, or to document the history of projects and community initiatives.

Real-time interaction for training

During blockchain workshops or training, I can use this method to show live examples of operations in progress, providing immersive, hands-on learning for participants.

Special events management

During events or challenges organized on Steem I can use this method to automate registration, track participation in real time and generate instant rankings based on defined criteria.

Development of tools for transparency

I can design a public interface that displays the activities of community funds or funded initiatives in real time thereby building trust and transparency within the community.

Use the streamOperations method to detect the following types of transactions: comment, transfer, transfer_to_vesting, withdraw_vesting. Analyze the information contained in these transactions and show a message for each case.

Detection of comment type operations

The comment type operation is triggered each time a user creates a new post or responds to an existing post on the Steem blockchain, with the streamOperations method, it is possible to listen to these events in time real and extract the corresponding information, The essential fields of this operation include the author of the comment or post, the permlink which is a unique identifier, as well as the details of the parent if it is a reply, if the parent_author field is empty, this indicates that this is a new post, otherwise it is a response, the script analyzes this information and displays an appropriate message for each case.

comment.gif

Detection of transfer type operations

The transfer type operation corresponds to transfers of tokens such as STEEM or SBD between accounts on the Steem blockchain, the streamOperations method makes it possible to capture these transactions and extract detailed information such as the sender , the recipient, the amount transferred as well as a possible memo, this data is useful for monitoring payments, donations or any other financial activity, the script below allows you to detect these transfers and display the relevant information.

transfer.gif

Detection of transfer_to_vesting type operations

The transfer_to_vesting type operation occurs when a user converts liquid STEEM into Steem Power, increasing its influence on the blockchain, this operation can also include transferring Steem Power to another account, thanks to the method streamOperations, it is possible to detect these transactions and extract details like sender, recipient and amount converted, if the to field is empty, it means the user has made a transfer towards his own account.

transfer_to_vesting.gif

Detection of withdraw_vesting type operations

The withdraw_vesting type operation is triggered when a user withdraws Steem Power to convert it to liquid STEEM, a process also called "power down", with streamOperations it is possible to monitor these events and to obtain information such as the account initiating the withdrawal and the amount of Steem Power being converted, this script can detect these transactions and display the relevant details.

withdraw_vesting.gif

These scripts allow real-time monitoring of the Steem blockchain for specific operations and can be adapted to include additional features like account filtering or automatic notifications, the use of long sentences facilitates an explanation continues the process while limiting punctuation for a smooth narrative style.

Hear the blockchain and detect when you give a vote with your own account (start the bot and then give votes, and show how you detect it)

The following script is designed to listen to the Steem blockchain in real time and detect all voting operations carried out by your Steem account, in this case the kouba01 account, it uses the streamOperations method of the Steem JS library to capture all operations that occur on the blockchain and filters only those of the vote type, when a voting operation is detected, the script checks if the voter field corresponds to your kouba01 account, if this is the case, if applicable it displays the details of the operation, in particular the author of the publication or comment voted on, the unique link (“permlink”) of this publication and the weight of the vote expressed as a percentage .

image.png

This script displays in detail the information regarding each vote detected for the kouba01 account, making it easy to track all voting interactions for this account on the blockchain, the information displayed includes the name of the author of the voted post or comment , the unique link to identify this publication or comment, as well as the percentage of vote applied, this monitoring is carried out continuously and in real time as long as the script is running, to use this script, simply run it in a Node.js environment after installed the Steem JS library.

vote.gif


Thank you very much for reading, it's time to invite my friends @pelon53, @crismenia, @bossj23 to participate in this contest.

Best Regards,
@kouba01

Sort:  

Damn. The last slide nailed it. I almost didn't understand from the beginning due to the terms used but as I saw Steem, I became even more interested and Boom, I understood everything. You've written well Sir. I don't need an interpreter to understand the script you made. You've explained everything step-by-step to my understanding. I really appreciate. I would have participated but I don't have a laptop at the moment. Best of luck in this course. Looking forward to learning from you in future. 🫂

Coin Marketplace

STEEM 0.31
TRX 0.27
JST 0.045
BTC 102228.51
ETH 3688.34
SBD 2.80