Exemple #1
0
def wasp():
    """Go down the list of Steem Engine tokens and transfer full balance to destination"""
    send_to = input("Enter destination: ")
    active_wif = getpass(prompt="Active key: ")

    steem = Steem(keys=[active_wif], nodes="https://api.steemit.com")
    w = Wallet(steem_instance=steem)
    t = Tokens()
    usr = w.getAccountFromPrivateKey(active_wif)
    sew = seWallet(account=usr, steem_instance=steem)
    tokens = sew.get_balances()
    for token in tokens:
        symbol = token["symbol"]
        info = t.get_token(symbol)
        p = info["precision"]
        b = float(token["balance"])
        balance = float(f"{b:.{p}f}")
        if balance > 0:
            print(f"[ Transfering {balance} of {symbol} to {send_to} ]")
            # pprint(sew.transfer(send_to, balance, symbol, memo="waspsting.py transfer")
            sew.transfer(send_to,
                         balance,
                         symbol,
                         memo="waspsting.py transfer")
            time.sleep(1)
    return None
Exemple #2
0
    def setUpClass(cls):
        stm = shared_steem_instance()
        stm.config.refreshBackup()
        nodelist = NodeList()
        nodelist.update_nodes(steem_instance=Steem(node=nodelist.get_nodes(
            normal=True, appbase=True),
                                                   num_retries=10))

        cls.stm = Steem(
            node=nodelist.get_nodes(),
            nobroadcast=True,
            # We want to bundle many operations into a single transaction
            bundle=True,
            num_retries=10
            # Overwrite wallet to use this list of wifs only
        )
        cls.stm.set_default_account("test")
        set_shared_steem_instance(cls.stm)
        # self.stm.newWallet("TestingOneTwoThree")

        cls.wallet = Wallet(steem_instance=cls.stm)
        cls.wallet.wipe(True)
        cls.wallet.newWallet(pwd="TestingOneTwoThree")
        cls.wallet.unlock(pwd="TestingOneTwoThree")
        cls.wallet.addPrivateKey(wif)
Exemple #3
0
def claim_it(chain, mana):
    """Very simple Utility to claim HIVE and/or STEEM account tokens"""

    api = {"steem": "https://api.steemit.com", "hive": "https://api.hive.blog"}
    wif = click.prompt("Enter private key",
                       confirmation_prompt=False,
                       hide_input=True)
    for network in chain:
        steem = Steem(node=api[network], keys=wif)
        set_shared_steem_instance(steem)
        wallet = Wallet(shared_steem_instance())
        steemid = wallet.getAccountFromPrivateKey(wif)
        account = Account(steemid, steem_instance=shared_steem_instance())
        mana_old = account.get_rc_manabar()
        mana_human_readable = mana_old["current_mana"] / 1e9

        tries = 2
        for i in range(tries):
            try:
                if mana_human_readable > mana:
                    click.echo(f"[Mana on {network} Before: %f RC]" %
                               (mana_old["current_mana"] / 1e9))
                    tx = steem.claim_account(creator=steemid, fee=None)
                    pprint(tx)
                    time.sleep(5)
                    mana_new = account.get_rc_manabar()
                    click.echo(f"[Mana on {network} After: %f RC]" %
                               (mana_new["current_mana"] / 1e9))
                    rc_costs = mana_old["current_mana"] - mana_new[
                        "current_mana"]
                    click.echo("[Mana cost: %f RC]" % (rc_costs / 1e9))
                else:
                    click.echo(
                        f"[Skipping claim account: current mana of %f lower than the set limit of %f on {network}]"
                        % (mana_human_readable, mana))
                    time.sleep(5)
            except Exception as e:
                click.echo('[Error:', e, ' - Trying Again]')
                time.sleep(2)
                if i < tries:
                    continue
                else:
                    click.echo('[Failed to claim]')
            else:
                break
Exemple #4
0
 def test_wallet(self, node_param):
     if node_param == "instance":
         stm = Steem(node="abc", autoconnect=False, num_retries=1)
         set_shared_steem_instance(self.bts)
         o = Wallet()
         self.assertIn(o.steem.rpc.url, self.urls)
         with self.assertRaises(NumRetriesReached):
             o = Wallet(steem_instance=stm)
             o.steem.get_config()
     else:
         set_shared_steem_instance(
             Steem(node="abc", autoconnect=False, num_retries=1))
         stm = self.bts
         o = Wallet(steem_instance=stm)
         self.assertIn(o.steem.rpc.url, self.urls)
         with self.assertRaises(NumRetriesReached):
             o = Wallet()
             o.steem.get_config()
Exemple #5
0
 def test_wallet(self, node_param):
     if node_param == "instance":
         set_shared_steem_instance(self.bts)
         o = Wallet()
         self.assertIn(o.steem.rpc.url, self.urls)
         with self.assertRaises(RPCConnection):
             o = Wallet(steem_instance=Steem(
                 node="https://abc.d", autoconnect=False, num_retries=1))
             o.steem.get_config()
     else:
         set_shared_steem_instance(
             Steem(node="https://abc.d", autoconnect=False, num_retries=1))
         stm = self.bts
         o = Wallet(steem_instance=stm)
         self.assertIn(o.steem.rpc.url, self.urls)
         with self.assertRaises(RPCConnection):
             o = Wallet()
             o.steem.get_config()
Exemple #6
0
def wasp():
    """ Go down the list of Steem Engine tokens and transfer full balance to destination"""
    send_to = input('Enter destination: ')
    active_wif = input('Enter your Active Key: ')
    steem = Steem(keys=[active_wif], nodes='https://api.steemit.com')
    w = Wallet(steem_instance=steem)
    t = Tokens()    
    usr = w.getAccountFromPrivateKey(active_wif)
    sew = seWallet(account=usr, steem_instance=steem)
    tokens = sew.get_balances()
    for token in tokens:
        symbol = token['symbol']
        info = t.get_token(symbol)
        p = info['precision']
        b = float(token['balance'])
        balance = float(f'{b:.{p}f}')
        if balance > 0:
            print(f'[ Transfering {balance} of {symbol} to {send_to} ]')
            #pprint(sew.transfer(send_to, balance, symbol, memo="waspsting.py transfer")
            sew.transfer(send_to, balance, symbol, memo="waspsting.py transfer")
            time.sleep(1)
    return None
Exemple #7
0
#!/usr/bin/env python3
import getpass
from pprint import pprint

from beem import Steem
from beem.account import Account
from beem.wallet import Wallet

active_wif = getpass.getpass(prompt='Active key: ')

hv = Steem(node="http://anyx.io", keys=[active_wif])
w = Wallet(steem_instance=hv)
usr = w.getAccountFromPrivateKey(active_wif)
a = Account(usr, steem_instance=hv)
deleg = a.get_vesting_delegations()
for x in deleg:
    delegatee = x['delegatee']
    print(f'[Dropping delegation to {delegatee} to 0]')
    pprint(a.delegate_vesting_shares(delegatee, 0))
Exemple #8
0
            for acc_name in accounts:
                acc = Account(acc_name, steem_instance=stm)

                a = AccountVotes(acc_name, steem_instance=stm)
                print(acc_name)
                for vote in a:
                    author = vote["author"]
                    if author in member_data:
                        member_data[author]["rewarded_rshares"] += int(
                            vote["rshares"])
                        member_data[author]["balance_rshares"] -= int(
                            vote["rshares"])

        if True:
            b = Blockchain(steem_instance=stm)
            wallet = Wallet(steem_instance=stm)
            accountTrx = {}
            for acc_name in accounts:
                print(acc_name)
                db = dataset.connect(databaseConnector)
                accountTrx[acc_name] = AccountTrx(db, acc_name)

                comments_transfer = []
                comments = []
                ops = accountTrx[acc_name].get_all(op_types=["transfer"])
                cnt = 0
                for o in ops:
                    cnt += 1
                    if cnt % 10000 == 0:
                        print("%d/%d" % (cnt, len(ops)))
                    op = json.loads(o["op_dict"])
Exemple #9
0
from io import StringIO
from pprint import pprint

import requests
from beem.steem import Steem
from beem.wallet import Wallet
from pandas import read_csv
from sqlalchemy import create_engine

logging.basicConfig(level=logging.INFO,
                    format="%(asctime)s %(message)s",
                    datefmt="%m/%d/%Y %I:%M:%S %p")

wif = os.environ["STEEM_WIF"]
stm = Steem(node="https://api.steemit.com", keys=wif, nobroadcast=False)
w = Wallet(blockchain_instance=stm)
author = w.getAccountFromPrivateKey(wif)
logging.debug(author)
engine = create_engine("sqlite:///covid.db")
covid_cvs = requests.get(
    "https://opendata.ecdc.europa.eu/covid19/casedistribution/csv")
yesterday = datetime.now() + timedelta(days=-1)
covid_day = yesterday.strftime("%d/%m/%Y")
df = read_csv(StringIO(covid_cvs.text))
sql = df.to_sql("Covid", con=engine, if_exists="replace")
result = engine.execute(f'SELECT * FROM Covid where dateRep="{covid_day}"')
data = result.fetchall()


def main():
    title = f"European Centre for Disease Prevention and Control Report for Date {covid_day}"
Exemple #10
0
 def test_wallet(self):
     o = Wallet()
     self.assertEqual(o.steem.rpc.url, self.url)
Exemple #11
0
fig = plt.figure(figsize=(12, 6))
p1 = fig.add_subplot(121, title="Vote signers by number")
p1.pie(by_number, labels=labels, autopct="%.1f%%")
p2 = fig.add_subplot(122, title="Vote signers by value")
p2.pie(by_value, labels=labels, autopct="%.1f%%")
plt.savefig("share.png")

print("\nTotal number of voters: %d" % (len(all_voters)))
for signer in signers:
    print("| %s | %.2f%% |" %
          (signer, len(voters[signer]) * 100 / len(all_voters)))

print("\nMost frequent vote signers")
i = 1
w = Wallet()
print("| Rank | #Votes | PublicKey | Account |")
for key, count in zip(keys.xrange()[:10], keys.yrange()[:10]):
    print("| %d | %d | %s | %s |" %
          (i, count, key, list(w.getAccountsFromPublicKey(key))))
    i += 1

print("\nMost frequent vote signers by value")
i = 1
w = Wallet()
print("| Rank | #Votes | PublicKey | Account |")
for key, count in zip(keys_val.xrange()[:10], keys_val.yrange()[:10]):
    print("| %d | %d | %s | %s |" %
          (i, count, key, list(w.getAccountsFromPublicKey(key))))
    i += 1