Voting Weight for SP less than 500 - SP小于500也可以通过程序来设置点赞百分比

in cn •  2 years ago  (edited)


Image Credit: Steemit Post

It is said that, if you have less than 500 SP, you won't see this voting weight bar when you upvote.
江湖传言,SP小于500,你在点赞的时候是看不到这个条的:

It means that each vote is 100%, which you could verify on steemd.
如果看不到条,你的点赞是100%的,在 steemd 上查询是这样的:

I write a Python script to verify this:
但是我通过程序来验证了一下:

def vote(id, key, url, score = 100.0):
  wif = {
      "posting": key
  }
  try:
    steem = Steem(keys=wif)    
    return(steem.vote(url, score, id))
  except:
    pass

For example, vote('some_id_less_than_500sp', key, 'some_url', 30) is successful even for minnows with less than 500 SP
比如 vote('some_id_less_than_500sp', key, 'some_url', 30) 是成功的:

Apart from this, I learn that:
除此之外还意外了解到:

If a post or comment has been voted, when you upvote it again:

  • If the voting weight is the same as last time, nothing will happen i.e. nor the blockchain will not accept your vote, neither it will consume your voting power.
  • However, if the voting weight for that post or comment is different, the blockchain will accept this vote, update the voting weight and you will consume the voting power.

如果已经点赞了,下次再同样点赞的时候分两种情况:

  • 如果点赞百分比和已经点赞的百分比是一样的,那么系统不会接受你的这次投票,不会消耗你的 Voting Power
  • 如果点赞百分比和上次点赞的不一样, 那么系统会授受你的这次投票,并且更新你的投票比重和消耗你的 Voting Power

You could also enforce a duplicate-upvote-check locally, marking a vote has been done in local file system or database.

我有点强迫,我怕重复投票,即使在比重一样的情况下也怕重复的投票,所以我本地先判断有没有已经投过,这个可以通过本地数据库记录,不过可以更简单的使用一下文件就可以:

def vote(id, key, url, score = 100.0):
  wif = {
      "posting": key
  }
  fn = id + '_' + md5(url) + '_' + str(score) 
  ok = not os.path.isfile(fn)
  if not ok:
    print("voted already: " + fn)  
    return  
  touch(fn)
  try:
    steem = Steem(keys=wif)    
    print("voted: " + fn)
    return(steem.vote(url, score, id))
  except:
    pass

This actually is 50% of the voting robots such as @randowhale and @minnowbooster where the 50% rest is to listen the transactions of the wallet, make votes and record them in the database (or filesystem).

这样其实已经完成了 @randowhale 或者 @minnowbooster 点赞机器人的50%工作, 剩下50%就是 监听钱包到帐,然后根据钱的数量 投个票, 记录在数据库(或者文件中).

Originally published at https://steemit.com Thank you for reading my post, feel free to Follow, Upvote, Reply, ReSteem (repost) @justyy which motivates me to create more quality posts.

原文首发于 https://Steemit.com 首发。感谢阅读,如有可能,欢迎Follow, Upvote, Reply, ReSteem (repost) @justyy 激励我创作更多更好的内容。

// Later, it will be reposted to my blogs: justyy.com, helloacm.com and codingforspeed.com 稍后同步到我的中文博客和英文计算机博客

近期热贴

Recent Popular Posts


Tags: #cn #cn-programming #steemstem #steemit #python

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:  

高端的。

试试看 ,py大法好!

經過差不多兩個月,很高興昨天終於看到這條 bar 😊

羡慕一下

我确实看不到那个条

加把劲,很快就能让你纠结了

哈哈~ 小時候沒有那個百分比比較不困擾啊 XD

痛苦的一大原因就是 拥有选择