Follow the leader | Stalking all accounts that someone else follows using @emrebeyler's Hivemind

in #hivemind6 years ago


image.png
Hivemind SQL by @emrebeyler. Just queried all accounts that @teamaustralia is following.

Just over a couple of weeks ago, @emrebeyler was kind enough to give me access to his Hivemind database instance. It's basically access to a read-only PostgreSQL database of a Hivemind instance. I had a poke around the tables when I first got my credentials but its taken only until now to find a practical use for it.

If you follow my blog (or have come across my posts), you'll know that I'm from Australia. Fellow Aussie, @ausbitbank, sponsored me through his @centerlink account not long after I joined Steem. Over time, I got to know and follow other Aussies on Steem and I was informed that the @teamaustralia account probably follows all the known Aussies to date. Not too long ago, I snapped up the @teamstraya account as a test curation account with leased Steem Power (a separate post on this later!). What better way to test curation than on my fellow #teamaustralia members? It's currently trailing the @centerlink account.

Now onto the Hivemind! I want @teamstraya to follow all the accounts @teamaustralia is following. I think this query achieves it (please correct me if I'm wrong...and it's probably not the most efficient query either!):

SELECT NAME 
FROM   hive_accounts 
WHERE  id IN (SELECT following 
              FROM   hive_follows 
              WHERE  follower = (SELECT id 
                                 FROM   hive_accounts 
                                 WHERE  NAME = 'teamaustralia')) 

Now for the quick-and-nasty way to follow all the accounts using steem-js:

// ...pg query => populate accounts array


followAccounts( accounts );

var i = 0;
function followAccounts( accounts )
{
  setTimeout( function() {

    var json = JSON.stringify(
      [
        'follow',
        {
          follower: acc,
          following: accounts[i],
          what: [ 'blog' ]
        }
      ]
    );

    Steem.broadcast.customJson( myKey, [], [acc], 'follow', json, function( err, result ) {
      console.log( err, result );
    } );

    i++;
    if( i < accounts.length )
      followAccounts( accounts );

  }, 3000 );
}

The @teamstraya SteemWorld is spammed with Follow Account operations now :P
image.png

And...finished! Mission accomplished!
image.png

Do you have any requests for stats that I could try pulling out from the Hivemind database? Let me know in the comments.

Yours truly,
@contrabourdon



Sort:  

Cool use case. It’s possible to bundle multiple follows into just one custom_json op afaik. It might be a little cost effective:)

Thanks! Cool, I'll investigate that for the next account I stalk. I think it ended up costing 5% RCs in total :P

Congratulations @contrabourdon, your post successfully recieved 0.317115 TRDO from below listed TRENDO callers:

@amico earned : 0.21141 TRDO curation


To view or trade TRDO go to steem-engine.com
Join TRDO Discord Channel or Join TRDO Web Site

An interesting initiative.

@tipu curate
@giphy curate 100


A huge hug from @amico! 🤗

#sbi-skip !trdo

Congratulations @amico, you successfuly trended the post shared by @contrabourdon!
@contrabourdon will receive 0.31711500 TRDO & @amico will get 0.21141000 TRDO curation in 3 Days from Post Created Date!

"Call TRDO, Your Comment Worth Something!"

To view or trade TRDO go to steem-engine.com
Join TRDO Discord Channel or Join TRDO Web Site

Upvoted 👌


Powered by witness untersatz!
Current VP: 69.3%

Thank you for supporting @CatsMakeKittens by being a part of our community @contrabourdon.

Each CATS you purchase gets you daily upvotes from me @CatScientist as our community grows so do your rewards for being a member!

You have received a 2.51% upvote based on your stake of 2010.01037432 UFM!

!shop
!BEER
for you

你好鸭,contrabourdon!

@eii给您叫了一份外卖!

@cecilian 粥粥 迎着台风 坐着高铁 给您送来
虾条

吃饱了吗?跟我猜拳吧! 石头,剪刀,布~

如果您对我的服务满意,请不要吝啬您的点赞~
@onepagex



Hey @contrabourdon, here is a little bit of BEER from @eii for you. Enjoy it!

Join Steem Power Up Day at the 1. of December and power up BEER

Coin Marketplace

STEEM 0.09
TRX 0.30
JST 0.035
BTC 111135.68
ETH 3940.56
USDT 1.00
SBD 0.59