By carefull with account history index, it is not reliablesteemCreated with Sketch.

in steemdev •  6 months ago 

Today, I was wondering why I was getting different results by using different nodes.

from beem import Steem
from beem.account import Account
from beem.amount import Amount

if __name__ == "__main__":
    stm = Steem(node="https://steemd.minnowsupportproject.org")
    stm = Steem(node="https://api.steemit.com")
    acc = Account("steembasicincome", steem_instance=stm)
    for h in acc.history(start=289250, only_ops=["transfer"], use_block_num=False):
        print("%d - %s transfer %s to %s - %s" % (h["index"], h["from"], str(Amount(h["amount"], steem_instance=stm)), acc["name"], str(h["timestamp"])))

When I run the script with https://steemd.minnowsupportproject.org:

289481 - nateonsteemit transfer 5.000 STEEM to steembasicincome - 2018-12-19T16:35:21
289484 - nateonsteemit transfer 3.000 STEEM to steembasicincome - 2018-12-19T16:39:36

When I use https://api.steemit.com:

289280 - kimzwarch transfer 3.000 STEEM to steembasicincome - 2018-12-19T07:34:06
289288 - darklands transfer 2.000 STEEM to steembasicincome - 2018-12-19T07:58:48
289334 - paulag transfer 8.000 STEEM to steembasicincome - 2018-12-19T09:28:42
289402 - shaidon transfer 1.000 STEEM to steembasicincome - 2018-12-19T11:41:00
289477 - elizacheng transfer 1.000 STEEM to steembasicincome - 2018-12-19T13:07:51
289478 - djennyfloro transfer 1.000 STEEM to steembasicincome - 2018-12-19T13:10:15
289487 - bengy transfer 1.000 STEEM to steembasicincome - 2018-12-19T13:27:54
289488 - bengy transfer 1.000 STEEM to steembasicincome - 2018-12-19T13:28:09
289491 - tazi transfer 1.000 STEEM to steembasicincome - 2018-12-19T13:31:00
289492 - tazi transfer 1.000 STEEM to steembasicincome - 2018-12-19T13:31:18
289498 - runicar transfer 3.000 STEEM to steembasicincome - 2018-12-19T13:52:24
289499 - runicar transfer 2.000 STEEM to steembasicincome - 2018-12-19T13:52:42
289501 - runicar transfer 1.000 STEEM to steembasicincome - 2018-12-19T13:56:45
289504 - team-cn transfer 2.000 STEEM to steembasicincome - 2018-12-19T14:09:54
289514 - barmbo transfer 1.000 STEEM to steembasicincome - 2018-12-19T15:01:03
289518 - cryptoyzzy transfer 6.000 STEEM to steembasicincome - 2018-12-19T15:13:12
289759 - nateonsteemit transfer 5.000 STEEM to steembasicincome - 2018-12-19T16:35:21
289762 - nateonsteemit transfer 3.000 STEEM to steembasicincome - 2018-12-19T16:39:36

So, using the history account index for receiving new account transactions is not a good idea. The index is calculated within the node and it is not reliable.

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:  

This story was recommended by Steeve to its users and upvoted by one or more of them.

Check @steeveapp to learn more about Steeve, an AI-powered Steem interface.

Here's an important follow-up question:

Is it supposed to be?

Or rather, is this a problem with the system as deployed or with a particular node not doing the job it's supposed to? Because if it's a problem with just the node, that can be fixed pretty easily and worked around in the meantime. If it's a problem with the system as a whole as deployed, and you can't really depend on the history account index for new account transactions on any node other than API.Steemit.com – that's an entirely different problem.

·

This is the fundamental problem of developers that do not document their code. To make my own thoughts clear, this is an issue with the Steem blockchain developers not with Beem or its developer. There is no promise that things should work this way and no warning that it doesn't but we naturally assume they should, and then we have angst when they do not work a certain way.

This problem involving history indexes should be mentioned to the Beem documentation. Although we don't know if it is a permanent problem or considered a bug by the Steem team.

·
·

You are right, I will add this to the beem docu. I think the solution is to use an index which is calculated from the block number, trx index, the operation index and an virtual op index.

Posted using Partiko Android

·
·
·

We expect index numbers to be:

  1. complete. We hope to see all the ops that are going to the blockchain.
  2. sequential: That is operation n+1 never happens before operation n. Although n+1 and n may happen at the same time. And if n+1 exists then n should exist. Things happen at the same time when they are part of the same transaction and may happen at the same time when they are in the same block.
  3. consistent. We should get the same values and order no matter which host we use (at least within the context of the same blockchain).

Now, #3 is broken because of something outside of scope of Beem. I don't think you should put too much time into working around something that is probably a bug. Documenting that this natural assumption (#3) is wrong (hopefully temporarily), is a good idea, though.

If you are going to give the API users #1 #2 #3 by calculating and deciding on a order in a way that is independent of the Steem RPC node, then we could continue to use the history index number as a key to our transactions we store in our app's database's.

Hi @holger80!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your UA account score is currently 7.278 which ranks you at #65 across all Steem accounts.
Your rank has improved 1 places in the last three days (old rank 66).

In our last Algorithmic Curation Round, consisting of 391 contributions, your post is ranked at #12.

Evaluation of your UA score:
  • Your follower network is great!
  • The readers appreciate your great work!
  • Good user engagement!

Feel free to join our @steem-ua Discord server

Useful information good job

This is why we need to set up a torrent so more of us have easy access to all the blocks. Why trust Steemit Inc's rushed programming when we can interpret the blockchain ourselves?

I've got a one terabyte SSD just sitting on my desk... I'm looking at it right now. LOL wtf am I doing!

This post has been just added as new item to timeline of beem on Steem Projects.

If you want to be notified about new updates from this project, register on Steem Projects and add beem to your favorite projects.

Thank you so much for participating the Partiko Delegation Plan Round 1! We really appreciate your support! As part of the delegation benefits, we just gave you a 3.00% upvote! Together, let’s change the world!

This post has been included in today's SOS Daily News - a digest of all you need to know about the State of Steem.



Lol! There's me!

Hi, @holger80!

You just got a 2.79% upvote from SteemPlus!
To get higher upvotes, earn more SteemPlus Points (SPP). On your Steemit wallet, check your SPP balance and click on "How to earn SPP?" to find out all the ways to earn.
If you're not using SteemPlus yet, please check our last posts in here to see the many ways in which SteemPlus can improve your Steem experience on Steemit and Busy.

Sometimes they change even on subsequent queries to the same node as well. I stopped using them in any way a long time ago due to that.

Posted using Steeve, an AI-powered Steem interface

Good to know!
By the way...It shouldn't be "Be careful with account history index, it is not reliable" instead of "By carefull with account history index, it is not reliable" ? :D

This post was upvoted by SteeveBot!

SteeveBot regularly upvotes stories that are appreciated by the community around Steeve, an AI-powered Steem interface.