Steemauto and its problems - Solved!

in utopian-io •  6 years ago 

steemauto_bitpizza.gif

GitHub
PR

Summary

We had a bad week!
Our main server got an advanced DDoS attack!
Our websites and our main RPC node went down!
...
and now, after a few days, the main features are up!

Explanation

despaired-2261021_640.jpg
source: pixabay.com

After noticing that our server is under high DDoS attack, I paused that server and moved all data to another server.
I started websites and features (curation trail, fanbase, and etc) on our backup server and backup RPC node! We experienced some new errors (related to libraries like steem-js and dsteem)!
I tried almost any method to fix these problems, and I got nothing in the result!
Today I decided to develop our customized methods to interact with steem blockchain instead of using steem-js and dsteem (thanks to the developers of these tools;) )

Our backup RPC node is appbase (v0.19.10) and needs new configurations to interact with that server directly without any middleware like Jussi (for example Jussi is installed on https://api.steemit.com to interact with appbases)

children-593313_640.jpg
source: pixabay.com

I started this Pull Request for fixing common issues we had in these days. Right now, must of the tasks completed and I'm working on the remaining tasks.
I will add more tasks to the list (if needed) to solve completely RPC node errors which are happening because of the high load of Steemauto!

Clarification

During these problems, all critical data was safe! (actually, we don't have such critical data in our servers)
I bought another server (256GB RAM) and I moved websites and backend apps to that server. Also, I started a local RPC node (v0.19.5) which is reliable than appbase (v0.19.10) for our use case!

Now, all the main services (curation trail, fanbase, schedule posts, and etc ) should work without any downtime. Enjoy using our free and unlimited services.


Development

I started by adding streaming methods, which are the important part of Steemauto. We should stream all latest blocks to detect recent upvotes by trails and recent posts by fans! Our recent method for streaming blocks was from steem-js which can be paused after any network error!

programming-1873854_640 (1).png
source: pixabay.com

By adding our customized methods for streaming blocks (block numbers and block operations) streaming methods will not fail, in any case with help of our call() method, the streaming methods will try to stream the latest block.

const streamBlockNumber = async (cb) => {
  let lastBlock = 0
  setInterval(async () => {
    const result = await call(
      config.steemd,
      'condenser_api.get_dynamic_global_properties',
      []
    )
    if (result && result.head_block_number && !isNaN(result.head_block_number)) {
      if (result.head_block_number > lastBlock) {
        lastBlock = result.head_block_number
        cb(lastBlock)
      }
    }
  }, 500)
}

We used a call() method to make jsonrpc 2.0 calls directly to the our appbase. This call method will just return the result or null! by ignoring errors in the call method, we can easily retry another call by checking just returned result.

This is our call() method:

const call = async (steemd, method, params) => {
  try {
    const body = JSON.stringify({
      id: 0,
      jsonrpc: '2.0',
      method,
      params
    })
    const res = await fetch(
      steemd,
      {
        method: 'POST',
        body
      }
    )
    if (res.ok) {
      const result = await res.json()
      return result.result
    } else {
      return null
    }
  } catch (e) {
    return null
  }
}

Maybe it is not a good solution to ignore errors, but in our use case, this is the best solution! If the main node was down, we can add some extra code to change config.steemd and use another RPC node. (maybe in another contribution)

Then, we used these methods inside our apps instead of libraries like steem-js and dsteem.
By using these methods, our apps are working very well! (community confirmed)

Also, we exported similar parts of our apps to the extra files to reduce duplicate codes. For example, broadcasting upvotes and checking the voting power limit are the most used parts in all apps.
(still is not implemented in the apps)

Now, we can expect a better Steematuo!

Steem on and support Steemauto with your upvotes, resteems, donations, and witness votes ;)

team-3373638_640.jpg
source: pixabay.com

Thanks for your great support


This post is submitted to the https://utopian.io

Regards,
2018-07-30

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Well done sir.

I got nothing to point out on this PR.

  • Your post is pleasant to read.
  • Your commit history is clear and precise.
  • You've commented important part of the code to help read it.
  • All best practices seem to be respected.

This is a great improvement from your previous contributions.

Congratulations

Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, click here.


Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

Thanks a lot, @mahdiyari. Great work.

Thanks for all the work you have done which I guess it has been very tough this week. You will have always my support.


Congrats, you made the #steemitminute for today!
Click the Image Below to see the Video!

Thank you very much for your support and interest @mahdiyari, I am glad that you have been able to solve most of the problems and everything starts to normalize. Receive my affections

Thanks!! You are awesome!!!

Where can I find a list of all of the RPC calls?

But all the rpc nodes rely on api.steemit.com. Almost all.... When there's trouble with one rpc node the other node will have the same prob. This is my experience so far. I wonder when is it possible not to rely on only one single source of data.

No, that is not true!
You can run your own RPC node and use that without a problem. Of course, blockchain is the same, if there was a problem with the blockchain, everything will get that problem!

I think I speak for all of the users of Steemauto when I say, "Thank You!"

We have no idea what you are talking about, but it sounds like hard work and we are glad that you are doing so much for Steemit and the users of Steemauto.

Thank you for your work! I love Steemauto and Steemfollowes, they are two of my favorite apps.

سلام
برای اولین بار دارم کامنت فارسی میزارم
ایرانی هستی، درسته؟

Hi,
bale

Nice to meet you then.
I thought I'm the only one :D
Trying to learn about your @steemauto
Looks useful
Thanks anyways and good luck

good luck

Thanks

  ·  6 years ago 

I used that most of my time in browsing Steemit, thanks for your hard work to resolved it, thanks!

Posted using Partiko iOS

wow its great and good news sir.. thanks for share..

good news. Thanks very much.

well done and thank you for your great work @mahdiyari... so the problem resolved and I can see my auto-upvote working gorgeously. keep up the good work

Hey @mahdiyari
Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!

Thanks for all your effort, @mahdiyari: I feel you do all with true love, isn't' it?

A huge hug from @amico!
(Resteemed with joy and love.)

Congratulations @mahdiyari!
Your post was mentioned in the Steemit Hit Parade in the following category:

  • Upvotes - Ranked 5 with 1413 upvotes

Cảm ơn tất cả các công việc bạn đã làm

upvote me

  ·  6 years ago (edited)

Autosteem is a great service! Please implement an option for: Auto follow back. I would like to automatically follow all those who follow me. I think others would also find it useful to have this option.
I vote you for my Witness!

Hello !

I love your steemauto project, that is really a great development for common steemian.

Can you please respond to me in steem.chat. I want to talk to you regarding something else, I think you are a geek, so I want to know something from you.

I’m pretty sure this is the right place to ask. @mahdiyari or @-anyone who can give me a hand. I’d like to set myself to Upvote posts that my wife Upvotes. I don’t see a way to do that on Steemauto, am I missing something? I can follow her and be the first to upvote her posts. Is it possible to set myself up to automatically upvote the posts she Upvotes?

@mahdiyari, I am having issues with your site steemfollower as I have 20 upvotes but received just 5 ? I am not giving any more as its not even hit the value as stated on right side

Why did a post from CHB artist, three hours ago, not get up voted from my steemauto fanbase?

send me that post