Exemple #1
0
def unlock_steempy_wallet():
    """ Unlock steempy wallet from cli input. """
    wallet = Wallet()
    if KeyEncryptionKey.config_key in configStorage:
        if not env_unlocked():
            wallet.unlock()
            if wallet.locked():
                print('No Wallet password. Quitting.')
                quit(1)
    else:
        print('steempy wallet does not exist.'
              'Please import your active key before publishing feeds.')
        quit(1)
class ChainInterface:
    chain_id = '0000000000000000000000000000000000000000000000000000000000000000'
    chain_prefix = 'STM'
    steem_symbol = 'STEEM'
    sbd_symbol = 'SBD'
    vests_symbol = 'VESTS'
    steemd_nodes = ['https://api.steemit.com', 'https://steemd.steemit.com']

    def __init__(self, debug_mode=False):
        self.steemd_rpc = steem.steemd.Steemd(nodes=self.steemd_nodes)
        self.debug_mode = debug_mode
        steembase.chains.known_chains['STEEM'] = {
            'chain_id': self.chain_id,
            'prefix': self.chain_prefix,
            'steem_symbol': self.steem_symbol,
            'sbd_symbol': self.sbd_symbol,
            'vests_symbol': self.vests_symbol
        }

    def use_botuser(self, botuser=None):
        """ Tell the interface what the username/password for bot user is
       """
        self.bot_username = botuser.username
        self.bot_password = botuser.password

        self.keys = [
            str(botuser.posting_key.get_private_key()),
            str(botuser.active_key.get_private_key()),
            str(botuser.owner_key.get_private_key())
        ]
        pprint.pprint(self.keys)
        self.wallet = Wallet(steemd_instance=self.steemd_rpc, keys=[])
        self.wallet.prefix = self.chain_prefix
        self.wallet.setKeys(self.keys)

    def get_steem_committer(self):
        retval = Commit(steemd_instance=self.steemd_rpc,
                        debug=self.debug_mode,
                        keys=self.keys)
        return retval

    def register_user(self, new_username=None, new_password=None):
        """ Attempt to register a new user on the blockchain
       """
        committer = self.get_steem_committer()
        retval = committer.create_account(new_username,
                                          password=new_password,
                                          store_keys=False,
                                          creator=self.bot_username)
        return retval
Exemple #3
0
def unlock_steempy_wallet():
    """ Unlock steempy wallet from cli input. """
    wallet = Wallet()
    if MasterPassword.config_key in configStorage:
        if not env_unlocked() and not Wallet.masterpassword:
            pwd = wallet.getPassword(text='BIP38 Wallet Password: '******'No Wallet password. Quitting.')
                quit(1)
    else:
        print('steempy wallet does not exist.'
              'Please import your active key before publishing feeds.')
        quit(1)
    def use_botuser(self, botuser=None):
        """ Tell the interface what the username/password for bot user is
       """
        self.bot_username = botuser.username
        self.bot_password = botuser.password

        self.keys = [
            str(botuser.posting_key.get_private_key()),
            str(botuser.active_key.get_private_key()),
            str(botuser.owner_key.get_private_key())
        ]
        pprint.pprint(self.keys)
        self.wallet = Wallet(steemd_instance=self.steemd_rpc, keys=[])
        self.wallet.prefix = self.chain_prefix
        self.wallet.setKeys(self.keys)
    def __init__(self,
                 tx=None,
                 steemd_instance=None,
                 wallet_instance=None,
                 no_broadcast=False,
                 expiration=60):
        self.steemd = steemd_instance or shared_steemd_instance()
        self.no_broadcast = no_broadcast
        self.expiration = expiration
        self.wallet = wallet_instance or Wallet(self.steemd)

        self.op = []
        self.wifs = []
        if tx and not isinstance(tx, dict):
            raise ValueError("Invalid Transaction (self.tx) Format")
        super(TransactionBuilder, self).__init__(tx or {})
Exemple #6
0
from steembase.memo import get_shared_secret, init_aes, _pad, _unpad
from steem.utils import compat_bytes

from contextlib import suppress
from binascii import hexlify, unhexlify
from collections import OrderedDict
from datetime import datetime
import json

epoch = datetime.utcfromtimestamp(0)

steemd_nodes = ['http://127.0.0.1:8765']
set_shared_steemd_instance(Steemd(nodes=steemd_nodes))
custom_instance = Steemd(nodes=steemd_nodes)
pr = custom_instance.get_chain_properties()
wallet_instance = Wallet(steemd_instance=custom_instance)


def encrypt(priv, pub, nonce, message):
    shared_secret = get_shared_secret(priv, pub)
    aes, check = init_aes(shared_secret, nonce)
    raw = compat_bytes(message, 'utf8')
    " Padding "
    BS = 16
    if len(raw) % BS:
        raw = _pad(raw, BS)
    " Encryption "
    enc_msg = aes.encrypt(raw)
    cipher = hexlify(enc_msg).decode('ascii')
    return cipher, check, len(enc_msg)
Exemple #7
0
ROCKET_CHAT_LOGIN = environ.get('ROCKET_CHAT_LOGIN')
ROCKET_CHAT_PASSWORD = environ.get('ROCKET_CHAT_PASSWORD')
ROCKET_CHAT_URL = environ.get('ROCKET_CHAT_URL')

STEEM_NODES = [node.strip() for node in environ.get('STEEM_NODES').split(',')]

set_shared_steemd_instance(Steemd(nodes=STEEM_NODES))

STEEM_NODES = [node.strip() for node in environ.get('STEEM_NODES').split(',')]

STEEM_ACCOUNT = environ.get('STEEM_ACCOUNT')
STEEM_POSTING_KEY = environ.get('STEEM_POSTING_KEY')

from steem.wallet import Wallet
Wallet(keys=[STEEM_POSTING_KEY])

PROJECT_GITHUB_REPOSITORY_URL = environ.get('PROJECT_GITHUB_REPOSITORY_URL')
if PROJECT_GITHUB_REPOSITORY_URL.endswith("/"):
    PROJECT_GITHUB_REPOSITORY_URL = PROJECT_GITHUB_REPOSITORY_URL[:-1]

PROJECT_SLUG_ON_PAGE = environ.get('PROJECT_SLUG_ON_PAGE')

PROJECT_IMAGE_THUMBNAIL_RATIO = (16, 9)

PROJECT_IMAGE_THUMBNAIL_SIZES = (
    (64, 36),
    (128, 72),
    (320, 180),
    (640, 360),
    (1024, 576),