コード例 #1
0
def get_config_node(node,
                    num_retries=10,
                    num_retries_call=10,
                    timeout=60,
                    how_many_seconds=30):
    blockchain_version = u'0.0.0'
    is_hive = False
    sucessfull = True
    error_msg = None
    access_time = timeout
    config = {}
    start_total = timer()
    try:
        stm = Steem(node=node,
                    num_retries=num_retries,
                    num_retries_call=num_retries_call,
                    timeout=timeout)
        blockchain_version = stm.get_blockchain_version()
        is_hive = stm.is_hive
        start = timer()
        config = stm.get_config(use_stored_data=False)
        stop = timer()
        access_time = stop - start
        config_count = 0

    except NumRetriesReached:
        error_msg = 'NumRetriesReached'
        sucessfull = False
    except KeyboardInterrupt:
        error_msg = 'KeyboardInterrupt'
        # quit = True
    except Exception as e:
        error_msg = str(e)
    total_duration = float("{0:.2f}".format(timer() - start_total))
    access_time = float("{0:.2f}".format(access_time))
    ret = {
        'sucessfull': sucessfull,
        'node': node,
        'error': error_msg,
        'total_duration': total_duration,
        'count': None,
        'access_time': access_time,
        'version': blockchain_version,
        'config': config,
        'is_hive': is_hive
    }
    return ret
コード例 #2
0
import io
import logging

from beem.blockchain import Blockchain
from beem.block import Block
from beem.account import Account
from beem.amount import Amount
from beemgraphenebase.account import PasswordKey, PrivateKey, PublicKey
from beem.steem import Steem
from beem.utils import parse_time, formatTimedelta
from beemapi.exceptions import NumRetriesReached
from beem.nodelist import NodeList
log = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO)


if __name__ == "__main__":
    stm = Steem(node=["https://testnet.steemitdev.com"],
                custom_chains={"TESTNETHF20":
                               {'chain_assets':
                                [
                                    {"asset": "@@000000013", "symbol": "SBD", "precision": 3, "id": 0},
                                    {"asset": "@@000000021", "symbol": "STEEM", "precision": 3, "id": 1},
                                    {"asset": "@@000000037", "symbol": "VESTS", "precision": 6, "id": 2}
                                ],
                                'chain_id': '46d82ab7d8db682eb1959aed0ada039a6d49afa1602491f93dde9cac3e8e6c32',
                                'min_version': '0.20.0',
                                'prefix': 'TST'}})
    print(stm.get_blockchain_version())
    print(stm.get_config()["STEEM_CHAIN_ID"])
コード例 #3
0
            "account": "guest123",
            "social_action_comment_update": {
                "permlink": 'just-a-test-post',
                "title": "just a test post",
                "body": "test post body",
            }
        })

    op3 = operations.Vote(
        **{
            'voter': 'guest123',
            'author': 'wlsuser',
            'permlink': 'another-test-post',
            'weight': 10000,
        })

    privateWif = "5K..."
    tx = TransactionBuilder(use_condenser_api=True, steem_instance=wls)
    tx.appendOps(op1)
    tx.appendWif(privateWif)
    tx.sign()
    tx.broadcast()


if __name__ == "__main__":
    # `blocking=True` forces use of broadcast_transaction_synchronous
    wls = Steem(node=["https://pubrpc.whaleshares.io"], blocking=True)
    print(wls.get_blockchain_version())
    print(wls.get_config())
    test_post(wls)