def test_authorperm_resolve(self): self.assertEqual(resolve_authorperm('https://d.tube/#!/v/pottlund/m5cqkd1a'), ('pottlund', 'm5cqkd1a')) self.assertEqual(resolve_authorperm("https://steemit.com/witness-category/@gtg/24lfrm-gtg-witness-log"), ('gtg', '24lfrm-gtg-witness-log')) self.assertEqual(resolve_authorperm("@gtg/24lfrm-gtg-witness-log"), ('gtg', '24lfrm-gtg-witness-log')) self.assertEqual(resolve_authorperm("https://busy.org/@gtg/24lfrm-gtg-witness-log"), ('gtg', '24lfrm-gtg-witness-log')) self.assertEqual(resolve_authorperm('https://dlive.io/livestream/atnazo/61dd94c1-8ff3-11e8-976f-0242ac110003'), ('atnazo', '61dd94c1-8ff3-11e8-976f-0242ac110003'))
def test_authorperm_resolve(self): self.assertEqual( resolve_authorperm('theaussiegame/cryptokittie-giveaway-number-2'), ('theaussiegame', 'cryptokittie-giveaway-number-2')) self.assertEqual( resolve_authorperm( 'holger80/virtuelle-cloud-mining-ponzi-schemen-auch-bekannt-als-hypt' ), ('holger80', 'virtuelle-cloud-mining-ponzi-schemen-auch-bekannt-als-hypt')) self.assertEqual( resolve_authorperm( 'https://steemit.com/deutsch/holger80/virtuelle-cloud-mining-ponzi-schemen-auch-bekannt-als-hypt' ), ('holger80', 'virtuelle-cloud-mining-ponzi-schemen-auch-bekannt-als-hypt'))
def setUpClass(cls): nodelist = NodeList() nodelist.update_nodes(steem_instance=Steem(node=nodelist.get_nodes( normal=True, appbase=True), num_retries=10)) cls.bts = Steem(node=nodelist.get_nodes(appbase=False), use_condenser=True, nobroadcast=True, unsigned=True, keys={"active": wif}, num_retries=10) cls.appbase = Steem(node=nodelist.get_nodes(normal=False, appbase=True), nobroadcast=True, unsigned=True, keys={"active": wif}, num_retries=10) acc = Account("holger80", steem_instance=cls.bts) comment = acc.get_blog(limit=20)[-1] cls.authorperm = comment.authorperm [author, permlink] = resolve_authorperm(cls.authorperm) cls.author = author cls.permlink = permlink cls.category = comment.category cls.title = comment.title
def setUpClass(cls): nodelist = NodeList() nodelist.update_nodes(steem_instance=Steem(node=nodelist.get_nodes(exclude_limited=False), num_retries=10)) node_list = nodelist.get_nodes(exclude_limited=True) cls.bts = Steem( node=node_list, use_condenser=True, nobroadcast=True, unsigned=True, keys={"active": wif}, num_retries=10 ) cls.steemit = Steem( node="https://api.steemit.com", nobroadcast=True, unsigned=True, keys={"active": wif}, num_retries=10 ) acc = Account("holger80", steem_instance=cls.bts) comment = acc.get_feed(limit=20)[-1] cls.authorperm = comment.authorperm [author, permlink] = resolve_authorperm(cls.authorperm) cls.author = author cls.permlink = permlink cls.category = comment.category cls.title = comment.title
def setUpClass(cls): cls.bts = Steem( node=get_node_list(appbase=False), nobroadcast=True, keys={"active": wif}, num_retries=10 ) cls.appbase = Steem( node=get_node_list(appbase=True), nobroadcast=True, keys={"active": wif}, num_retries=10 ) cls.authorperm = "@gtg/ffdhu-gtg-witness-log" [author, permlink] = resolve_authorperm(cls.authorperm) cls.author = author cls.permlink = permlink cls.category = 'witness-category' cls.title = 'gtg witness log' # from getpass import getpass # self.bts.wallet.unlock(getpass()) set_shared_steem_instance(cls.bts) cls.bts.set_default_account("test") cnt = 0 title = '' while cnt < 5 and title == '': c = Comment(cls.authorperm, steem_instance=cls.bts) title = c["title"] cls.bts.rpc.next()
def setUpClass(cls): cls.bts = Steem(node=get_node_list(appbase=True), use_condenser=True, nobroadcast=True, keys={"active": wif}, num_retries=10) cls.appbase = Steem(node=get_node_list(appbase=True), nobroadcast=True, keys={"active": wif}, num_retries=10) cls.authorperm = "@gtg/ffdhu-gtg-witness-log" [author, permlink] = resolve_authorperm(cls.authorperm) cls.author = author cls.permlink = permlink cls.category = 'witness-category' cls.title = 'gtg witness log'
def setUpClass(cls): node_list = get_hive_nodes() cls.bts = Hive(node=node_list, use_condenser=True, nobroadcast=True, unsigned=True, keys={"active": wif}, num_retries=10) acc = Account("fullnodeupdate", blockchain_instance=cls.bts) comment = Comment(acc.get_blog_entries(limit=5)[1], blockchain_instance=cls.bts) cls.authorperm = comment.authorperm [author, permlink] = resolve_authorperm(cls.authorperm) cls.author = author cls.permlink = permlink cls.category = comment.category cls.title = comment.title
def __resolve_authorperm(self): if self.authorperm is None or self.authorperm == "": return author, permlink = resolve_authorperm(self.authorperm) comment = Comment(self.authorperm) created = comment.json()["created"] acc = Account(author) body_versions = [] for h in acc.history_reverse(only_ops=["comment"]): if h["permlink"] != permlink: continue body_versions.append({"timestamp": h["timestamp"], "body": h["body"]}) if h["timestamp"] == created: break if len(body_versions) > 0: self.__main_window_ui.fileTreeView.grid() self.__main_window_ui.fileTreeYScrollbar.grid() self.__main_window_ui.fileTreeXScrollbar.grid() self.__main_window_ui.fileTreeView.delete(*self.__main_window_ui.fileTreeView.get_children()) self.__main_window_ui.fileTreeView.heading('#0', text=self.authorperm, anchor=W) body_left = "" body_right = "" for entry in body_versions[::-1]: if body_right == "": body_right = entry["body"] body_left = "" elif entry["body"].find("@@") > -1: import diff_match_patch as dmp_module dmp = dmp_module.diff_match_patch() patches = dmp.patch_fromText(entry["body"]) body_left = body_right body_right = dmp.patch_apply(patches, body_right)[0] else: body_left = body_right body_right = entry["body"] bindValue=(body_left, body_right, "") oid = self.__main_window_ui.fileTreeView.insert("", 'end', text=entry["timestamp"], value=bindValue, open=False, tags=('simple'))
node_list = nodes.get_nodes(exclude_limited=False) stm = Steem(node=node_list, num_retries=5, call_num_retries=3, timeout=15, nobroadcast=nobroadcast) stm.wallet.unlock(wallet_password) last_voter = None print("Start apply new timebased votes") voter_counter = 0 delete_pending_votes = [] rc_sp_to_low_account_list = [] vote_counter = 0 vote_count = 0 for pending_vote in pendingVotesTrx.get_command_list_timed(): settings = None voter_acc = None author, permlink = resolve_authorperm(pending_vote["authorperm"]) if pending_vote["voter"] in rc_sp_to_low_account_list: continue age_min = (datetime.utcnow() - pending_vote["comment_timestamp"]).total_seconds() / 60 maximum_vote_delay_min = pending_vote["maximum_vote_delay_min"] if age_min < pending_vote["vote_delay_min"] - voting_round_sec / 2.0 / 60 - 3: # print("%s is not ready yet - %.2f min should be %.2f" % (pending_vote["authorperm"], age_min, pending_vote["vote_delay_min"])) continue if settings is None: settings = accountsTrx.get(pending_vote["voter"]) if settings is None: voter_acc = Account(pending_vote["voter"], steem_instance=stm) print("update %s - did not exists" % pending_vote["voter"])
tx_time = {"$gt": tx_start, "$lte": tx_end} tx_conds = {'type': 'transfer', 'timestamp': tx_time} tx_proj = {'_id': 0, 'to': 1, 'memo': 1, 'timestamp': 1} botlist = set() bot_votes = {} bottracker_list = [] with open("bots.txt") as f: for line in f.readlines(): bottracker_list.append(line[:-1]) uniq = {} for tx in db.Operations.find(tx_conds, projection=tx_proj): try: author, permlink = resolve_authorperm(tx['memo']) except ValueError: continue bot = tx['to'] identifier = author + permlink if bot in uniq and identifier in uniq[bot]: continue min_time = tx['timestamp'] max_time = min_time + timedelta(hours=5) time_contraints = {"$gt": min_time, "$lte": max_time} op_conds = { 'type': 'vote', 'author': author, 'permlink': permlink, 'voter': bot, 'timestamp': time_contraints
node_list = nodes.get_nodes(exclude_limited=False) stm = Steem(node=node_list, num_retries=5, call_num_retries=3, timeout=15, nobroadcast=nobroadcast) stm.wallet.unlock(wallet_password) voter_this_round = {} vote_count = 0 rc_sp_to_low_account_list = [] vote_ops = [] for vote in broadcastVoteTrx.get_all_expired(): if vote["voter"] in voter_this_round: # and (datetime.utcnow() - voter_this_round[vote["voter"]]).total_seconds() < 3: # print("Skip %s for this round" % vote["voter"]) continue author, permlink = resolve_authorperm(vote["authorperm"]) if vote["voter"] in rc_sp_to_low_account_list: continue settings = accountsTrx.get(vote["voter"]) if settings is None: voter_acc = Account(vote["voter"], steem_instance=stm) print("update %s - did not exists" % vote["voter"]) posting_auth = False for a in voter_acc["posting"]["account_auths"]: if a[0] == posting_auth_acc: posting_auth = True if vote["voter"] == posting_auth_acc: posting_auth = True